homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: PyDateTime_IMPORT() causes compiler warnings
Type: compile error Stage: resolved
Components: None Versions: Python 2.5
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: belopolsky Nosy List: belopolsky, jackdied, murrayc
Priority: normal Keywords:

Created on 2009年12月09日 10:01 by murrayc, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Messages (3)
msg96166 - (view) Author: Murray Cumming (murrayc) Date: 2009年12月09日 10:01
At least in Python 2.5 and 2.6 (I haven't checked newer versions), the 
PyDateTime_IMPORT() macro passes string literals to a function that
takes non-const char* parameters:
#define PyDateTime_IMPORT \
 PyDateTimeAPI = (PyDateTime_CAPI*) PyCObject_Import("datetime", \
 "datetime_CAPI")
This makes it impossible to build code with warnings as errors, when
using that macro.
msg99833 - (view) Author: Jack Diederich (jackdied) * (Python committer) Date: 2010年02月22日 21:14
changing the definition to (const char *) seems like the right thing to do - a quick grep of the Python source and a search on google codesearch only shows uses with either string literals or string literals cast to (char *) in order to silence a warning. I tried changing it on the 2.x trunk and it compiles with no warnings.
+1, any other opinions?
msg107201 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010年06月06日 18:04
PyCObject is deprecated in 2.7 and removed in 3.x. PyCapsule_Import() should be used instead of PyCObject_Import() and it already has correct signature:
Include/pycapsule.h:PyAPI_FUNC(void *) PyCapsule_Import(const char *name, int no_block);
Since this is not a bug, I don't think it is appropriate to change it in 2.x.
History
Date User Action Args
2022年04月11日 14:56:55adminsetgithub: 51712
2010年06月12日 06:45:02belopolskysetstatus: pending -> closed
2010年06月06日 18:04:08belopolskysetstatus: open -> pending
resolution: out of date
messages: + msg107201

stage: needs patch -> resolved
2010年06月06日 01:28:14belopolskysetassignee: belopolsky

nosy: + belopolsky
stage: needs patch
2010年02月22日 21:14:30jackdiedsetnosy: + jackdied
messages: + msg99833
2009年12月09日 10:01:50murrayccreate

AltStyle によって変換されたページ (->オリジナル) /