Title: datetime_strptime is 'NoneType' when restart cpython · Issue #117914 · python/cpython · GitHub
Open Graph Title: datetime_strptime is 'NoneType' when restart cpython · Issue #117914 · python/cpython
X Title: datetime_strptime is 'NoneType' when restart cpython · Issue #117914 · python/cpython
Description: Bug report Bug description: When executing the following code, it will appear TypeError: 'NoneType' object is not callable #include "Python.h" #include
Open Graph Description: Bug report Bug description: When executing the following code, it will appear TypeError: 'NoneType' object is not callable #include "Python.h" #include
X Description: Bug report Bug description: When executing the following code, it will appear TypeError: 'NoneType' object is not callable #include "Python.h" #include <iostream> void py_te...
Opengraph URL: https://github.com/python/cpython/issues/117914
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"datetime_strptime is 'NoneType' when restart cpython","articleBody":"# Bug report\n\n### Bug description:\n\nWhen executing the following code, it will appear `TypeError: 'NoneType' object is not callable`\n```c++\n#include \"Python.h\"\n#include \u003ciostream\u003e\n\nvoid py_test() {\n Py_Initialize();\n auto pName = PyUnicode_DecodeFSDefault(\"datetime\");\n auto pModule = PyImport_Import(pName);\n auto datetime = PyObject_GetAttrString(pModule, \"datetime\");\n auto strptime = PyObject_GetAttrString(datetime, \"strptime\");\n auto args = PyTuple_New(2);\n PyTuple_SetItem(args, 0, PyUnicode_FromString(\"2000-01\"));\n PyTuple_SetItem(args, 1, PyUnicode_FromString(\"%Y-%m\"));\n auto res = PyObject_CallObject(strptime, args);\n PyObject_Print(res, stdout, 0);\n Py_Finalize();\n}\n\nint main() {\n py_test();\n std::cout \u003c\u003c \"========\" \u003c\u003c std::endl;\n py_test();\n return 0;\n}\n```\n\n\n### CPython versions tested on:\n\n3.11\n\n### Operating systems tested on:\n\nmacOS\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-117915\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/marin-man","@type":"Person","name":"marin-man"},"datePublished":"2024-04-16T02:58:52.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/117914/cpython/issues/117914"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:09e99509-c2af-872a-9c12-595722b63067 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BBE8:17997A:2ADF76:3A0608:6969A9F2 |
| html-safe-nonce | dfb63962ea7b4829237fe9088a919715c068288008780cbe779fe26453d703fc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQkU4OjE3OTk3QToyQURGNzY6M0EwNjA4OjY5NjlBOUYyIiwidmlzaXRvcl9pZCI6IjE4NjcyODU2OTEzODkwMjg4NTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9e2065ccf72026192025ac3dc8d14cd080ad2b4036bd7356dfdfdc340e49cace |
| hovercard-subject-tag | issue:2244994618 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/117914/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f6400b5a8efdfeadb5f6dc20e9894ab1f1265adec56b280d1a19daebca0d85b1/python/cpython/issues/117914 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f6400b5a8efdfeadb5f6dc20e9894ab1f1265adec56b280d1a19daebca0d85b1/python/cpython/issues/117914 |
| og:image:alt | Bug report Bug description: When executing the following code, it will appear TypeError: 'NoneType' object is not callable #include "Python.h" #include |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | marin-man |
| hostname | github.com |
| expected-hostname | github.com |
| None | 24c4c97a2d520cb286b35e1a4c22d7a4df3c26a2fa28dd7cdf0e65db327b4de7 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 124667f43168afb6c9c03b7c02eb5b1d2e1be3d9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width