Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
Closed
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
When executing the following code, it will appear TypeError: 'NoneType' object is not callable
#include"Python.h" #include<iostream>voidpy_test(){Py_Initialize(); auto pName = PyUnicode_DecodeFSDefault("datetime"); auto pModule = PyImport_Import(pName); auto datetime = PyObject_GetAttrString(pModule, "datetime"); auto strptime = PyObject_GetAttrString(datetime, "strptime"); auto args = PyTuple_New(2); PyTuple_SetItem(args, 0, PyUnicode_FromString("2000-01")); PyTuple_SetItem(args, 1, PyUnicode_FromString("%Y-%m")); auto res = PyObject_CallObject(strptime, args); PyObject_Print(res, stdout, 0); Py_Finalize()} intmain(){py_test(); std::cout << "========" << std::endl; py_test(); return0}CPython versions tested on:
3.11
Operating systems tested on:
macOS
Linked PRs
Metadata
Metadata
Assignees
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error