| 395 | } // namespace |
| 396 | |
| 397 | void InitPandasStaticData() { |
| 398 | pandas_runner.RunOnce([](OwnedRef& module) { |
| 399 | OwnedRef ref; |
| 400 | |
| 401 | // set NaT sentinel and its type |
| 402 | if (ImportFromModule(module.obj(), "NaT", &ref).ok()) { |
| 403 | pandas_NaT = ref.obj(); |
| 404 | // PyObject_Type returns a new reference but we trust that pandas.NaT will |
| 405 | // outlive our use of this PyObject* |
| 406 | pandas_NaTType = Py_TYPE(ref.obj()); |
| 407 | } |
| 408 | |
| 409 | // retain a reference to Timedelta |
| 410 | if (ImportFromModule(module.obj(), "Timedelta", &ref).ok()) { |
| 411 | pandas_Timedelta = ref.obj(); |
| 412 | } |
| 413 | |
| 414 | // retain a reference to Timestamp |
| 415 | if (ImportFromModule(module.obj(), "Timestamp", &ref).ok()) { |
| 416 | pandas_Timestamp = ref.obj(); |
| 417 | } |
| 418 | |
| 419 | // if pandas.NA exists, retain a reference to it |
| 420 | if (ImportFromModule(module.obj(), "NA", &ref).ok()) { |
| 421 | pandas_NA = ref.obj(); |
| 422 | } |
| 423 | |
| 424 | // Import DateOffset type |
| 425 | if (ImportFromModule(module.obj(), "DateOffset", &ref).ok()) { |
| 426 | pandas_DateOffset = ref.obj(); |
| 427 | } |
| 428 | }); |
| 429 | } |
| 430 | |
| 431 | bool PandasObjectIsNull(PyObject* obj) { |
| 432 | if (!MayHaveNaN(obj)) { |
no test coverage detected