Commit graph

84 commits

Author SHA1 Message Date
Ken Jin 28873a7050
Fix signed/unsigned comparison to avoid compilation warning (GH-24441) 2021-02-04 21:38:18 +00:00
Victor Stinner 32bd68c839
bpo-42519: Replace PyObject_MALLOC() with PyObject_Malloc() (GH-23587)
No longer use deprecated aliases to functions:

* Replace PyObject_MALLOC() with PyObject_Malloc()
* Replace PyObject_REALLOC() with PyObject_Realloc()
* Replace PyObject_FREE() with PyObject_Free()
* Replace PyObject_Del() with PyObject_Free()
* Replace PyObject_DEL() with PyObject_Free()
2020-12-01 10:37:39 +01:00
Victor Stinner 00d7abd7ef
bpo-42519: Replace PyMem_MALLOC() with PyMem_Malloc() (GH-23586)
No longer use deprecated aliases to functions:

* Replace PyMem_MALLOC() with PyMem_Malloc()
* Replace PyMem_REALLOC() with PyMem_Realloc()
* Replace PyMem_FREE() with PyMem_Free()
* Replace PyMem_Del() with PyMem_Free()
* Replace PyMem_DEL() with PyMem_Free()

Modify also the PyMem_DEL() macro to use directly PyMem_Free().
2020-12-01 09:56:42 +01:00
Victor Stinner 15edaecd97
bpo-40989: Fix compiler warning in winreg.c (GH-21722)
Explicitly cast PyHKEYObject* to PyObject* to call _PyObject_Init().
2020-08-05 16:23:10 +02:00
Serhiy Storchaka 4c8f09d7ce
bpo-36346: Make using the legacy Unicode C API optional (GH-21437)
Add compile time option USE_UNICODE_WCHAR_CACHE. Setting it to 0
makes the interpreter not using the wchar_t cache and the legacy Unicode C API.
2020-07-10 23:26:06 +03:00
Victor Stinner 8182cc2e68
bpo-39573: Use the Py_TYPE() macro (GH-21433)
Replace obj->ob_type with Py_TYPE(obj).
2020-07-10 12:40:38 +02:00
Victor Stinner 04fc4f2a46
bpo-40989: PyObject_INIT() becomes an alias to PyObject_Init() (GH-20901)
The PyObject_INIT() and PyObject_INIT_VAR() macros become aliases to,
respectively, PyObject_Init() and PyObject_InitVar() functions.

Rename _PyObject_INIT() and _PyObject_INIT_VAR() static inline
functions to, respectively, _PyObject_Init() and _PyObject_InitVar(),
and move them to pycore_object.h. Remove their return value:
their return type becomes void.

The _datetime module is now built with the Py_BUILD_CORE_MODULE macro
defined.

Remove an outdated comment on _Py_tracemalloc_config.
2020-06-16 01:28:07 +02:00
Minmin Gong 98e42d1f88
bpo-35890: Use RegQueryInfoKeyW and CryptAcquireContextW explicitly (GH-19974) 2020-05-18 17:50:03 +01:00
Victor Stinner 4a21e57fe5
bpo-40268: Remove unused structmember.h includes (GH-19530)
If only offsetof() is needed: include stddef.h instead.

When structmember.h is used, add a comment explaining that
PyMemberDef is used.
2020-04-15 02:35:41 +02:00
Victor Stinner 9205520d8c
bpo-40170: PyObject_NEW() becomes an alias to PyObject_New() (GH-19379)
The PyObject_NEW() macro becomes an alias to the PyObject_New()
macro, and the PyObject_NEW_VAR() macro becomes an alias to the
PyObject_NewVar() macro, to hide implementation details. They no
longer access directly the PyTypeObject.tp_basicsize member.

Exclude _PyObject_SIZE() and _PyObject_VAR_SIZE() macros from
the limited C API.

Replace PyObject_NEW() with PyObject_New() and replace
PyObject_NEW_VAR() with PyObject_NewVar().
2020-04-08 00:38:15 +02:00
Steve Dower ee17e37356
bpo-39007: Add auditing events to functions in winreg (GH-17541)
Also allows winreg.CloseKey() to accept same types as other functions.
2019-12-09 11:18:12 -08:00
Steve Dower ef66f31ce2 bpo-32587: Fixes unsafe downcast in PC/winreg.c (GH-15766) 2019-09-09 14:24:15 +01:00
Zackery Spytz e223ba13d8 bpo-32587: Make winreg.REG_MULTI_SZ support zero-length strings (#13239)
* bpo-32587: Make winreg.REG_MULTI_SZ support PendingFileRenameOperations

* Address review comments.
2019-09-09 02:26:15 -07:00
David H ed5e8e06cb bpo-37730: Fix usage of NotImplemented instead of NotImplementedError in docs. (GH-15062) 2019-08-01 01:49:55 +03:00
Jeroen Demeyer 530f506ac9 bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async (GH-13464)
Automatically replace
tp_print -> tp_vectorcall_offset
tp_compare -> tp_as_async
tp_reserved -> tp_as_async
2019-05-30 19:13:39 -07:00
Zackery Spytz 34366b7f91 bpo-36672: Fix a compiler warning in winreg.SetValue() (GH-12882) 2019-04-22 10:08:05 -07:00
Zackery Spytz 56ed86490c bpo-9194: Fix the bounds checking in winreg.c's fixupMultiSZ() (GH-12687) 2019-04-22 10:01:32 -07:00
Inada Naoki cc60cdd9c4
bpo-8677: use PY_DWORD_MAX instead of INT_MAX (GH-12469) 2019-03-20 20:53:08 +09:00
Inada Naoki d5f18a63cc
bpo-8677: use PY_SSIZE_T_CLEAN in PC/winreg.c (GH-12466) 2019-03-20 19:10:17 +09:00
Tony Roberts 4860f01ac0 bpo-33895: Relase GIL while calling functions that acquire Windows loader lock (GH-7789)
LoadLibrary, GetProcAddress, FreeLibrary and GetModuleHandle acquire the system loader lock. Calling these while holding the GIL will cause a deadlock on the rare occasion that another thread is detaching and needs to destroy its thread state at the same time.
2019-02-02 09:16:42 -08:00
Serhiy Storchaka afb3e71a17
bpo-35489: Use "const Py_UNICODE *" for the Py_UNICODE converter in AC. (GH-11150) 2018-12-14 11:19:51 +02:00
Zackery Spytz 99d56b5356 bpo-35441: Remove dead and buggy code related to PyList_SetItem(). (GH-11033)
In _localemodule.c and selectmodule.c, remove dead code that would
cause double decrefs if run.

In addition, replace PyList_SetItem() with PyList_SET_ITEM() in cases
where a new list is populated and there is no possibility of an error.

In addition, check if the list changed size in the loop in array_array_fromlist().
2018-12-08 16:16:55 +02:00
Victor Stinner b509d52083
bpo-35059: PyObject_INIT() casts to PyObject* (GH-10674)
PyObject_INIT() and PyObject_INIT_VAR() now cast their first argument
to PyObject*, as done in Python 3.7.

Revert partially commit b4435e20a9.
2018-11-23 14:27:38 +01:00
Zackery Spytz 5d95312fb8 Replace dead code with an assertion in winreg.c. (GH-10028) 2018-11-08 11:45:00 +02:00
Victor Stinner b4435e20a9
bpo-35059: Convert PyObject_INIT() to function (GH-10077)
* Convert PyObject_INIT() and PyObject_INIT_VAR() macros to static
  inline functions.
* Fix usage of these functions: cast to PyObject* or PyVarObject*.
2018-10-26 14:35:00 +02:00
oldk aa0735f597 bpo-32747: Remove trailing spaces in docstrings. (GH-5491) 2018-02-02 10:52:55 +02:00
luzpaz a5293b4ff2 Fix miscellaneous typos (#4275) 2017-11-05 15:37:50 +02:00
Segev Finer 679b566622 bpo-9566: Fix some Windows x64 compiler warnings (#2492)
* bpo-9566: Silence liblzma warnings

* bpo-9566: Silence tcl warnings

* bpo-9566: Silence tk warnings

* bpo-9566: Silence tix warnings

* bpo-9566: Fix some library warnings

* bpo-9566: Fix msvcrtmodule.c warnings

* bpo-9566: Silence _bz2 warnings

* bpo-9566: Fixed some _ssl warnings

* bpo-9566: Fix _msi warnings

* bpo-9566: Silence _ctypes warnings

* Revert "bpo-9566: Fixed some _ssl warnings"

This reverts commit a639001c94.

* bpo-9566: Also consider NULL as a possible error in HANDLE_return_converter

* bpo-9566: whitespace fixes
2017-07-26 15:17:57 -07:00
Steve Dower 40fa26606d Issue #25778: winreg does not truncase string correctly (Patch by Eryk Sun) 2016-12-17 13:30:27 -08:00
Serhiy Storchaka 2954f83999 - Issue #27332: Fixed the type of the first argument of module-level functions
generated by Argument Clinic.  Patch by Petr Viktorin.
2016-07-07 18:20:03 +03:00
Serhiy Storchaka 1a2b24f02d Issue #27332: Fixed the type of the first argument of module-level functions
generated by Argument Clinic.  Patch by Petr Viktorin.
2016-07-07 17:35:15 +03:00
Serhiy Storchaka 877826ad3d Regenerate Argument Clinic code for issue #23026. 2016-06-09 16:01:19 +03:00
Steve Dower 4d4bc42c8b Closes #23026: Documentation improvements and code formatting 2016-05-25 11:26:07 -07:00
Steve Dower 80ac11d01e Issue #23026: winreg.QueryValueEx() now return an integer for REG_QWORD type. (Patch by hakril) 2016-05-24 15:42:04 -07:00
Serhiy Storchaka 6a7b3a77b4 Issue #26778: Fixed "a/an/and" typos in code comment and documentation. 2016-04-17 08:32:47 +03:00
Zachary Ware 77772c0e7b Issue #20172: Update clinicizations to current clinic. 2015-05-13 10:58:35 -05:00
Zachary Ware fd2d482272 Issue #20172: Convert the winreg module to Argument Clinic. 2015-05-13 01:21:57 -05:00
Serhiy Storchaka 1a1ff29659 Issue #23446: Use PyMem_New instead of PyMem_Malloc to avoid possible integer
overflows.  Added few missed PyErr_NoMemory().
2015-02-16 13:28:22 +02:00
Zachary Ware ad4690fcca Issue #21151: Fixed a segfault in the winreg module.
When ``None`` was passed as a ``REG_BINARY`` value to SetValueEx,
PyMem_DEL was called on an uninitialized buffer.  Patch by John Ehresman.

(Also an incidental typo fix in a comment in test_winreg)
2014-07-03 10:58:06 -05:00
Victor Stinner 9cb1ec5fb5 Issue #20908: PyMem_Malloc() must be used with PyMem_Free(), not with free() 2014-03-13 19:08:10 +01:00
Jesus Cea 58c767fa30 MERGE: Closes #20908: Memory leak in Reg2Py() 2014-03-13 17:38:20 +01:00
Jesus Cea 782c4cf155 Closes #20908: Memory leak in Reg2Py() 2014-03-13 17:35:32 +01:00
Serhiy Storchaka 46e1ce214b Issue #18783: Removed existing mentions of Python long type in docstrings,
error messages and comments.
2013-08-27 20:17:03 +03:00
Serhiy Storchaka 9594942716 Issue #18783: Removed existing mentions of Python long type in docstrings,
error messages and comments.
2013-08-27 19:40:23 +03:00
Victor Stinner b64049183c Issue #18203: Replace malloc() with PyMem_Malloc() in Python modules
Replace malloc() with PyMem_Malloc() when the GIL is held, or with
PyMem_RawMalloc() otherwise.
2013-07-07 16:21:41 +02:00
Brian Curtin f8704fb24e Merge 3.3 2012-12-27 14:06:38 -06:00
Brian Curtin e6bfa2911a Merge 3.2 2012-12-27 14:06:06 -06:00
Brian Curtin 172e42295f Fix #16759. Convert DWORD registry values using PyLong_FromUnsignedLong.
When converting REG_DWORD registry values into Python ints, the conversion
needs to be made from an *unsigned* long to match the DWORD type.
2012-12-27 14:04:42 -06:00
Brian Curtin 4482b01d23 Merge 3.3 2012-12-27 10:15:54 -06:00
Brian Curtin 62cf69ec7c Merge 3.2 2012-12-27 10:14:30 -06:00