Donghee Na
498a096a51
gh-112205: Support `@setter` annotation from AC (gh-112922)
...
---------
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-12-13 14:00:34 +00:00
Donghee Na
5b0629966f
gh-112205: Update stringio module to use AC for the thread-safe (gh-112549)
2023-12-01 08:37:30 +09:00
AN Long
77d9f1e6d9
gh-111965: Using critical sections to make ``io.StringIO`` thread safe. (gh-112116)
2023-11-19 21:34:40 +09:00
Victor Stinner
1a3faba9f1
gh-106869: Use new PyMemberDef constant names ( #106871 )
...
* Remove '#include "structmember.h"'.
* If needed, add <stddef.h> to get offsetof() function.
* Update Parser/asdl_c.py to regenerate Python/Python-ast.c.
* Replace:
* T_SHORT => Py_T_SHORT
* T_INT => Py_T_INT
* T_LONG => Py_T_LONG
* T_FLOAT => Py_T_FLOAT
* T_DOUBLE => Py_T_DOUBLE
* T_STRING => Py_T_STRING
* T_OBJECT => _Py_T_OBJECT
* T_CHAR => Py_T_CHAR
* T_BYTE => Py_T_BYTE
* T_UBYTE => Py_T_UBYTE
* T_USHORT => Py_T_USHORT
* T_UINT => Py_T_UINT
* T_ULONG => Py_T_ULONG
* T_STRING_INPLACE => Py_T_STRING_INPLACE
* T_BOOL => Py_T_BOOL
* T_OBJECT_EX => Py_T_OBJECT_EX
* T_LONGLONG => Py_T_LONGLONG
* T_ULONGLONG => Py_T_ULONGLONG
* T_PYSSIZET => Py_T_PYSSIZET
* T_NONE => _Py_T_NONE
* READONLY => Py_READONLY
* PY_AUDIT_READ => Py_AUDIT_READ
* READ_RESTRICTED => Py_AUDIT_READ
* PY_WRITE_RESTRICTED => _Py_WRITE_RESTRICTED
* RESTRICTED => (READ_RESTRICTED | _Py_WRITE_RESTRICTED)
2023-07-25 15:28:30 +02:00
Inada Naoki
d5bd32fb48
gh-104922: remove PY_SSIZE_T_CLEAN ( #106315 )
2023-07-02 15:07:46 +09:00
Victor Stinner
ef300937c2
gh-92536: Remove PyUnicode_READY() calls ( #105210 )
...
Since Python 3.12, PyUnicode_READY() does nothing and always
returns 0.
2023-06-02 01:33:17 +02:00
Erlend E. Aasland
186bf39f5c
gh-101819: Isolate `_io` ( #101948 )
...
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2023-05-15 09:26:27 +00:00
Victor Stinner
c84029179c
gh-101819: Prepare to modernize the _io extension ( #104178 )
...
* Add references to static types to _PyIO_State:
* PyBufferedIOBase_Type
* PyBytesIOBuffer_Type
* PyIncrementalNewlineDecoder_Type
* PyRawIOBase_Type
* PyTextIOBase_Type
* Add the defining class to methods:
* _io.BytesIO.getbuffer()
* _io.FileIO.close()
* Add get_io_state_by_cls() function.
* Add state parameter to _textiowrapper_decode()
* _io_TextIOWrapper___init__() now sets self->state before calling
_textiowrapper_set_decoder().
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-05-06 01:53:55 +02:00
Erlend E. Aasland
c00faf7943
gh-101819: Adapt _io types to heap types, batch 1 (GH-101949)
...
Adapt StringIO, TextIOWrapper, FileIO, Buffered*, and BytesIO types.
Automerge-Triggered-By: GH:erlend-aasland
2023-02-20 05:46:20 -08:00
Victor Stinner
7e3f09cad9
gh-99537: Use Py_SETREF() function in C code ( #99656 )
...
Fix potential race condition in code patterns:
* Replace "Py_DECREF(var); var = new;" with "Py_SETREF(var, new);"
* Replace "Py_XDECREF(var); var = new;" with "Py_XSETREF(var, new);"
* Replace "Py_CLEAR(var); var = new;" with "Py_XSETREF(var, new);"
Other changes:
* Replace "old = var; var = new; Py_DECREF(var)"
with "Py_SETREF(var, new);"
* Replace "old = var; var = new; Py_XDECREF(var)"
with "Py_XSETREF(var, new);"
* And remove the "old" variable.
2022-11-22 14:22:22 +01:00
Victor Stinner
7e4dec02ac
gh-99300: Use Py_NewRef() in Modules/ directory ( #99467 )
...
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and
Py_XNewRef() in test C files of the Modules/ directory.
2022-11-14 13:08:43 +01:00
Aivars Kalvāns
8c88e360e7
gh-95005: Replace PyAccu with PyUnicodeWriter (gh-95006)
2022-07-27 17:43:34 +09:00
Eric Snow
1f455361ec
bpo-46765: Replace Locally Cached Strings with Statically Initialized Objects (gh-31366)
...
https://bugs.python.org/issue46765
2022-02-22 17:23:51 -07: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
Andy Lester
dffe4c0709
bpo-39573: Finish converting to new Py_IS_TYPE() macro (GH-18601)
2020-03-04 14:15:20 +01:00
Petr Viktorin
ffd9753a94
bpo-39245: Switch to public API for Vectorcall (GH-18460)
...
The bulk of this patch was generated automatically with:
for name in \
PyObject_Vectorcall \
Py_TPFLAGS_HAVE_VECTORCALL \
PyObject_VectorcallMethod \
PyVectorcall_Function \
PyObject_CallOneArg \
PyObject_CallMethodNoArgs \
PyObject_CallMethodOneArg \
;
do
echo $name
git grep -lwz _$name | xargs -0 sed -i "s/\b_$name\b/$name/g"
done
old=_PyObject_FastCallDict
new=PyObject_VectorcallDict
git grep -lwz $old | xargs -0 sed -i "s/\b$old\b/$new/g"
and then cleaned up:
- Revert changes to in docs & news
- Revert changes to backcompat defines in headers
- Nudge misaligned comments
2020-02-11 17:46:57 +01:00
Serhiy Storchaka
1f21eaa15e
bpo-15999: Clean up of handling boolean arguments. (GH-15610)
...
* Use the 'p' format unit instead of manually called PyObject_IsTrue().
* Pass boolean value instead 0/1 integers to functions that needs boolean.
* Convert some arguments to boolean only once.
2019-09-01 12:16:51 +03:00
Min ho Kim
39d87b5471
Fix typos mostly in comments, docs and test names (GH-15209)
2019-08-30 16:21:19 -04:00
Jeroen Demeyer
762f93ff2e
bpo-37337: Add _PyObject_CallMethodNoArgs() (GH-14267)
2019-07-08 17:19:25 +09: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
Victor Stinner
bcda8f1d42
bpo-35081: Add Include/internal/pycore_object.h (GH-10640)
...
Move _PyObject_GC_TRACK() and _PyObject_GC_UNTRACK() from
Include/objimpl.h to Include/internal/pycore_object.h.
2018-11-21 22:27:47 +01:00
Victor Stinner
e281f7d80c
bpo-35081: Move accu.h to Include/internal/pycore_accu.h (GH-10271)
...
The accu.h header is no longer part of the Python C API: it has been
moved to the "internal" headers which are restricted to Python
itself.
Replace #include "accu.h" with #include "pycore_accu.h".
2018-11-01 02:30:36 +01:00
Serhiy Storchaka
fdb5a50ef3
bpo-25862: Fix several bugs in the _io module. (GH-8026)
...
They can be exposed when some C API calls fail due to lack of
memory.
* Failed Py_BuildValue() could cause an assertion error in the
following TextIOWrapper.tell().
* input_chunk could be decrefed twice in TextIOWrapper.seek()
after failed Py_BuildValue().
* initvalue could leak in StringIO.__getstate__() after failed
PyDict_Copy().
2018-06-30 20:57:50 +03:00
Siddhesh Poyarekar
55edd0c185
bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS. (GH-6030)
...
METH_NOARGS functions need only a single argument but they are cast
into a PyCFunction, which takes two arguments. This triggers an
invalid function cast warning in gcc8 due to the argument mismatch.
Fix this by adding a dummy unused argument.
2018-04-29 21:59:33 +03:00
Serhiy Storchaka
55fe1ae970
bpo-30022: Get rid of using EnvironmentError and IOError (except test… ( #1051 )
2017-04-16 10:46:38 +03:00
Serhiy Storchaka
762bf40438
bpo-29852: Argument Clinic Py_ssize_t converter now supports None ( #716 )
...
if pass `accept={int, NoneType}`.
2017-03-30 09:15:31 +03:00
Serhiy Storchaka
fff9a31a91
bpo-29865: Use PyXXX_GET_SIZE macros rather than Py_SIZE for concrete types. ( #748 )
2017-03-21 08:53:25 +02:00
Oren Milman
004251059b
bpo-29730: replace some calls to PyNumber_Check and improve some error messages ( #650 )
2017-03-13 00:37:05 +02:00
orenmn
740025478d
bpo-29741: Clean up C implementations of BytesIO and StringIO. ( #606 )
...
Some BytesIO methods now accept not just int subclasses but other int-like types.
2017-03-11 00:52:01 +02:00
Serhiy Storchaka
85b0f5beb1
Added the const qualifier to char* variables that refer to readonly internal
...
UTF-8 represenatation of Unicode objects.
2016-11-20 10:16:47 +02:00
Serhiy Storchaka
06515833fe
Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSize
...
with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
2016-11-20 09:13:07 +02:00
Martin Panter
abe4d52a1a
Merge doc and comment fixes from 3.5
2016-04-19 23:23:16 +00:00
Martin Panter
8f26565ba9
Fix spelling (inital), grammar (may translates) in documentation, comments
2016-04-19 04:03:41 +00:00
Serhiy Storchaka
b6a9c9761c
Issue #26778 : Fixed "a/an/and" typos in code comment, documentation and error
...
messages.
2016-04-17 09:39:28 +03:00
Martin Panter
f264416093
Issue #22413 : Remove comment made out of date by Argument Clinic
2015-10-10 10:17:57 +00:00
Martin Panter
3f930dcd87
Merge typo fixes from 3.4 into 3.5
2015-10-07 11:01:47 +00:00
Martin Panter
9955a373a8
Various minor typos in documentation and comments
2015-10-07 10:26:23 +00:00
Serhiy Storchaka
f24131ff31
Issue #20175 : Converted the _io module to Argument Clinic.
2015-04-16 11:19:43 +03:00
Antoine Pitrou
11946fbe80
Issue #15841 : The readable(), writable() and seekable() methods of BytesIO
...
and StringIO objects now raise ValueError when the object has been closed.
Patch by Alessandro Moura.
2012-09-05 20:13:48 +02:00
Antoine Pitrou
1d857453b7
Issue #15841 : The readable(), writable() and seekable() methods of BytesIO
...
and StringIO objects now raise ValueError when the object has been closed.
Patch by Alessandro Moura.
2012-09-05 20:11:49 +02:00
Antoine Pitrou
d0acb411ef
Issue #14387 : Do not include accu.h from Python.h.
2012-03-22 14:42:18 +01:00
Victor Stinner
9e30aa52fd
Fix misuse of PyUnicode_GET_SIZE() => PyUnicode_GET_LENGTH()
...
And PyUnicode_GetSize() => PyUnicode_GetLength()
2011-11-21 02:49:52 +01:00
Antoine Pitrou
de20b0b50e
Issue #13149 : Speed up append-only StringIO objects.
...
This is very similar to the "lazy strings" idea.
2011-11-10 21:47:38 +01:00
Victor Stinner
c4f281eba3
Fix misuse of PyUnicode_GET_SIZE, use PyUnicode_GET_LENGTH instead
2011-10-11 22:11:42 +02:00
Victor Stinner
e1335c711c
Fix usage og PyUnicode_READY()
2011-10-04 20:53:03 +02:00
Martin v. Löwis
d63a3b8beb
Implement PEP 393.
2011-09-28 07:41:54 +02:00
Ezio Melotti
3b3499ba69
#11565 : Merge with 3.1.
2011-03-16 11:35:38 +02:00
Ezio Melotti
13925008dc
#11565 : Fix several typos. Patch by Piotr Kasprzyk.
2011-03-16 11:05:33 +02:00
Antoine Pitrou
b82d5e1525
Merged revisions 84438 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r84438 | antoine.pitrou | 2010-09-02 21:48:07 +0200 (jeu., 02 sept. 2010) | 3 lines
BytesIO.getvalue() and StringIO.getvalue() are METH_NOARGS.
........
2010-09-02 22:21:32 +00:00
Antoine Pitrou
d5c3f6c839
BytesIO.getvalue() and StringIO.getvalue() are METH_NOARGS.
2010-09-02 19:48:07 +00:00