summaryrefslogtreecommitdiffstats
path: root/Modules/_testcapimodule.c
Commit message (Collapse)AuthorAgeFilesLines
* _PyLong_NumBits(): The definition of this was too specific to the quirkyTim Peters2003-01-311-21/+27
| | | | | | | | | needs of pickling longs. Backed off to a definition that's much easier to understand. The pickler will have to work a little harder, but other uses are more likely to be correct <0.5 wink>. _PyLong_Sign(): New teensy function to characterize a long, as to <0, ==0, or >0.
* Added new private API function _PyLong_NumBits. This will be used at theTim Peters2003-01-281-2/+39
| | | | | | | start for the C implemention of new pickle LONG1 and LONG4 opcodes (the linear-time way to pickle a long is to call _PyLong_AsByteArray, but the caller has no idea how big an array to allocate, and correct calculation is a bit subtle).
* Replace DL_IMPORT with PyMODINIT_FUNC and remove "/export:init..." linkMark Hammond2002-07-231-1/+1
| | | | | command line for Windows builds. This should allow MSVC to import and build the Python MSVC6 project files without error.
* Switch to using METH_NOARGS where possible.Fred Drake2002-04-011-38/+18
| | | | Convert to use PyModule_*() instead of manipulating the module dict directly.
* Fixed "u#" parser marker to pass through Unicode objects as-is withoutMarc-André Lemburg2002-01-091-0/+50
| | | | | | going through the buffer interface API. Added tests for this to the _testcapi module and updated docs.
* sprintf -> PyOS_snprintf in some "obviously safe" cases.Tim Peters2001-11-281-2/+3
| | | | | Also changed <>-style #includes to ""-style in some places where the former didn't make sense.
* Fixes for possible buffer overflows in sprintf() usages.Marc-André Lemburg2001-11-281-1/+1
|
* SF [#466125] PyLong_AsLongLong works for any integer.Tim Peters2001-09-301-0/+50
| | | | | | Generalize PyLong_AsLongLong to accept int arguments too. The real point is so that PyArg_ParseTuple's 'L' code does too. That code was undocumented (AFAICT), so documented it.
* Add tests for new PyErr_NormalizeException() behaviorJeremy Hylton2001-09-261-0/+26
| | | | | | | | | | | | Add raise_exception() to the _testcapi module. It isn't a test, but the C API exists only to support test_exceptions. raise_exception() takes two arguments -- an exception class and an integer specifying how many arguments it should be called with. test_exceptions uses BadException() to test the interpreter's behavior when there is a problem instantiating the exception. test_capi1() calls it with too many arguments. test_capi2() causes an exception to be raised in the Python code of the constructor.
* Patch #411138: Rename config.h to pyconfig.h. Closes bug #231774.Martin v. Löwis2001-07-261-1/+1
|
* Windows build broke from recent Unicode changes -- need to #defineTim Peters2001-06-261-0/+1
| | | | | | SIZEOF_SHORT by hand here. Also added dynamic check that SIZEOF_SHORT is correct for the platform (in _testcapimodule).
* Fix error in comment, and in test_long_api and test_longlong_api removeTim Peters2001-06-161-6/+2
| | | | the need for the F_ERROR macro.
* Fixed typo in comment.Tim Peters2001-06-141-1/+1
|
* Add tests of PyLong_{As,From}{Unsigned,}Long. These are very much likeTim Peters2001-06-141-158/+71
| | | | | | | | | | | the new PyLong_{As,From}{Unsigned,}LongLong tests, so the bulk of the code is in the new #include file testcapi_long.h, which generates different code depending on how macros are set. This sucks, but I couldn't think of anything that sucked less. UNIX headache? If we still maintain dependencies by hand, someone who knows what they're doing should teach whatever needs it that _testcapimodule.c includes testcapi_long.h.
* longobject.c:Tim Peters2001-06-131-15/+158
| | | | | | | | | | | Replaced PyLong_{As,From}{Unsigned,}LongLong guts with calls to _PyLong_{As,From}ByteArray. _testcapimodule.c: Added strong tests of PyLong_{As,From}{Unsigned,}LongLong. Fixes SF bug #432552 PyLong_AsLongLong() problems. Possible bugfix candidate, but the fix relies on code added to longobject to support the new q/Q structmodule format codes.
* The merest start of a test for the PyLong_{As,From}{Unsigned,}LongLong()Tim Peters2001-06-121-4/+57
| | | | | | | | | | functions. I intend to replace their guts with calls to the new _PyLong_{As,From}ByteArray() functions, but AFAICT there's no tests for them at all now; I also suspect PyLong_AsLongLong() isn't catching all overflow cases, but without a std test to demonstrate that why should you believe me <wink>. Also added a raiseTestError() utility function.
* Slight adaptation of Michael Hudson's patch to test PyDict_Next()Guido van Rossum2001-04-131-0/+62
| | | | | | | | | | | | (with modification of existing dict elements!). This is part of SF patch #409864: lazy fix for Pings bizarre scoping crash. The adaptation I made to Michael's patch was to change the error handling to avoid masking other errors (moving the specific error message to inside test_dict_inner()), and to insert a test for dict==NULL at the start.
* Related to SF bug 132008 (PyList_Reverse blows up).Tim Peters2001-02-121-0/+46
| | | | | | | | _testcapimodule.c make sure PyList_Reverse doesn't blow up again getargs.c assert args isn't NULL at the top of vgetargs1 instead of waiting for a NULL-pointer dereference at the end
* Renamed _testXXX to _testcapiXXX. Jack is my hero -- good call!Tim Peters2001-02-041-0/+68