| 372 | } // namespace |
| 373 | |
| 374 | void InitPandasStaticData() { |
| 375 | pandas_runner.RunOnce([](OwnedRef& module) { |
| 376 | OwnedRef ref; |
| 377 | |
| 378 | // set NaT sentinel and its type |
| 379 | if (ImportFromModule(module.obj(), "NaT", &ref).ok()) { |
| 380 | pandas_NaT = ref.obj(); |
| 381 | // PyObject_Type returns a new reference but we trust that pandas.NaT will |
| 382 | // outlive our use of this PyObject* |
| 383 | pandas_NaTType = Py_TYPE(ref.obj()); |
| 384 | } |
| 385 | |
| 386 | // retain a reference to Timedelta |
| 387 | if (ImportFromModule(module.obj(), "Timedelta", &ref).ok()) { |
| 388 | pandas_Timedelta = ref.obj(); |
| 389 | } |
| 390 | |
| 391 | // retain a reference to Timestamp |
| 392 | if (ImportFromModule(module.obj(), "Timestamp", &ref).ok()) { |
| 393 | pandas_Timestamp = ref.obj(); |
| 394 | } |
| 395 | |
| 396 | // if pandas.NA exists, retain a reference to it |
| 397 | if (ImportFromModule(module.obj(), "NA", &ref).ok()) { |
| 398 | pandas_NA = ref.obj(); |
| 399 | } |
| 400 | |
| 401 | // Import DateOffset type |
| 402 | if (ImportFromModule(module.obj(), "DateOffset", &ref).ok()) { |
| 403 | pandas_DateOffset = ref.obj(); |
| 404 | } |
| 405 | }); |
| 406 | } |
| 407 | |
| 408 | bool PandasObjectIsNull(PyObject* obj) { |
| 409 | if (!MayHaveNaN(obj)) { |
no test coverage detected