summaryrefslogtreecommitdiffstats
path: root/Modules/_testcapimodule.c
Commit message (Collapse)AuthorAgeFilesLines
* Change fix for segfaulting property(), add a NEWS entry and a test.Georg Brandl2006-08-041-0/+9
|
* Part of bug #1523610: fix miscalculation of buffer length.Georg Brandl2006-07-261-0/+11
| | | | | Also add a guard against NULL in converttuple and add a test case (that previously would have crashed).
* Remove lie in new comment.Tim Peters2006-05-131-3/+1
|
* Teach PyString_FromFormat, PyErr_Format, and PyString_FromFormatVTim Peters2006-05-131-4/+43
| | | | | | | | | | | | about "%u", "%lu" and "%zu" formats. Since PyString_FromFormat and PyErr_Format have exactly the same rules (both inherited from PyString_FromFormatV), it would be good if someone with more LaTeX Fu changed one of them to just point to the other. Their docs were way out of synch before this patch, and I just did a mass copy+paste to repair that. Not a backport candidate (this is a new feature).
* correct function signatureSkip Montanaro2006-04-181-1/+1
|
* Add a test for Py_ssize_t. Correct typo in getargs.c.Georg Brandl2006-04-131-11/+21
|
* Add PY_SSIZE_T_MIN/MAX to _testcapi.Georg Brandl2006-04-131-0/+2
|
* Fix some warnings on HP-UX when using cc/aCCNeal Norwitz2006-04-101-2/+2
|
* Try to repair at least one segfault on the Mac buildbot,Tim Peters2006-03-211-12/+42
| | | | | | | | | | | | | | | | | | | | | | as diagnosed by Nick Coghlan. test_capi.py: A test module should never spawn a thread as a side effect of being imported. Because this one did, the segfault one of its thread tests caused didn't occur until a few tests after test_regrtest.py thought test_capi was finished. Repair that. Also join() the thread spawned at the end, so that test_capi is truly finished when regrtest reports that it's done. _testcapimodule.c test_thread_state(): this spawns a couple of non-threading.py threads, passing them a PyObject* argument, but did nothing to ensure that those threads finished before returning. As a result, the PyObject* _could_ (although this was unlikely) get decref'ed out of existence before the threads got around to using it. Added explicit synchronization (via a Python mutex) so that test_thread_state can reliably wait for its spawned threads to finish.
* Add tests for the C APIs PyCodec_IncrementalEncoder() andWalter Dörwald2006-03-181-0/+24
| | | | PyCodec_IncrementalDecoder().
* Move test code out of xxmodule and into _testcapimodule.c where it belongs.Neal Norwitz2006-03-151-0/+13
| | | | Will backport.
* Merge ssize_t branch.Martin v. Löwis2006-02-151-1/+2
|
* Check return result from Py_InitModule*(). This API can fail.Neal Norwitz2006-01-191-0/+2
| | | | Probably should be backported.
* Fix silly leak in test used in test_exceptions.Michael W. Hudson2003-08-151-0/+1
|
* New support functions for test_getargs2.Thomas Heller2003-04-241-69/+70
| | | | | Theres now a separate function for each of the format codes b, B, H, I, k, i, l, L, K.
* Get test_capi & test_getargs2 to pass on alphasNeal Norwitz2003-04-221-6/+19
| | | | | | * UINT_MAX -> ULONG_MAX since we are dealing with longs * ParseTuple needs &int for 'i' and &long for 'l' There may be a better way to do this, but this works.
* New PyGILState_ API - implements pep 311, from patch 684256.Mark Hammond2003-04-191-0/+47
|
* SF # 595026: support for masks in getargs.c.Thomas Heller2003-04-171-0/+149
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New functions: unsigned long PyInt_AsUnsignedLongMask(PyObject *); unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *); unsigned long PyLong_AsUnsignedLongMask(PyObject *); unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *); New and changed format codes: b unsigned char 0..UCHAR_MAX B unsigned char none ** h unsigned short 0..USHRT_MAX H unsigned short none ** i int INT_MIN..INT_MAX I * unsigned int 0..UINT_MAX l long LONG_MIN..LONG_MAX k * unsigned long none L long long LLONG_MIN..LLONG_MAX K * unsigned long long none Notes: * New format codes. ** Changed from previous "range-and-a-half" to "none"; the range-and-a-half checking wasn't particularly useful. New test test_getargs2.py, to verify all this.
* Rename LONG_LONG to PY_LONG_LONG. Fixes #710285.Martin v. Löwis2003-03-291-5/+5
|
* _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