Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-119127: functools.partial placeholders#119303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
dg-pb wants to merge119 commits intopython:mainfromdg-pb:implement-119127
Closed
Changes from1 commit
Commits
Show all changes
119 commits
Select commitHold shift + click to select a range
ee7333c
Initial Implementation
dg-pbMay 21, 2024
8bcc462
serialization fix
dg-pbMay 21, 2024
c67c9b4
bug fix
dg-pbMay 21, 2024
680d900
Bug 2 fix
dg-pbMay 21, 2024
9591ff5
Py_TPFLAGS_IMMUTABLETYPE added
dg-pbMay 21, 2024
067e938
placeholder added to state as opposed to being used as global constant
dg-pbMay 23, 2024
8af20b3
static removed
dg-pbMay 23, 2024
607a0b1
creating sentinel via PyType_Spec
dg-pbMay 23, 2024
f55801e
more accurate variable name
dg-pbMay 23, 2024
5894145
trailing trim bug and tests
dg-pbMay 24, 2024
3722e07
Updated docs
dg-pbMay 24, 2024
a79c2af
blurb
dg-pbMay 24, 2024
12aaa72
Merge branch 'main' into implement-119127
May 24, 2024
92c767b
minor edit
dg-pbMay 24, 2024
496a9d2
doc fix
dg-pbMay 24, 2024
84be524
gh-119180: Update the magic number (#119397)
JelleZijlstraMay 25, 2024
de19694
gh-119105: Differ.compare is too slow [for degenerate cases] (#119492)
tim-oneMay 25, 2024
08e6543
gh-111999: Fix the signature of str.format_map() (#119540)
serhiy-storchakaMay 25, 2024
a531fd7
FAQ: Add reference to Python version numbering scheme (#119225)
hugovkMay 25, 2024
e3bac04
gh-119548: Add a 'clear' command to the REPL (#119549)
pablogsalMay 25, 2024
6b6c1a9
Add codeowners for PYREPL (#119550)
pablogsalMay 25, 2024
4b7eb32
gh-99180: Make `StackSummary.should_show_carets` private (#119554)
AlexWaygoodMay 25, 2024
0c5ebe1
gh-119560: Drop an Invalid Assert in PyState_FindModule() (gh-119561)
ericsnowcurrentlyMay 25, 2024
e418fc3
GH-82805: Fix handling of single-dot file extensions in pathlib (#118…
barneygaleMay 25, 2024
d25954d
docs: fix a few typos identified by codespell (#119516)
nedbatMay 26, 2024
b5b7dc9
Update README and layout.html from 3.13 to 3.14 (#119539)
Wulian233May 26, 2024
008bc04
gh-119562: Remove AST nodes deprecated since Python 3.8 (#119563)
AlexWaygoodMay 26, 2024
70b07aa
gh-111997: Fix argument count for LINE event and clarify type of argu…
scoderMay 26, 2024
0220663
gh-119562: Remove unused private string constants from `ast.py` (#119…
AlexWaygoodMay 26, 2024
5d04cc5
gh-102864: Add switching frame test for pdb (#119564)
gaogaotiantianMay 26, 2024
5482a93
Re-order imports to align with zipp 3.18.2 (#119587)
jaracoMay 27, 2024
5ef5622
Fix typos in HISTORY documentation (#119453)
xybMay 27, 2024
c7a5e1e
``Include/internal/pycore_import.h``: Fix typo (#119586)
Eclips4May 27, 2024
3b26cd8
gh-119467: Fix Py_buffer.format type and correct documentation typo (…
adiaholicMay 27, 2024
041a566
GH-117283: Add doc warning for `PyTuple_SetItem` refcount > 1 (#117916)
savannahostrowskiMay 27, 2024
59630f9
Docs: Add class role for IPV{4,6}Address and fix a typo (#118059)
rffontenelleMay 27, 2024
88e3fee
Docs: Only install sphinx-autobuild for `make htmllive` (#119607)
hugovkMay 27, 2024
3dfa364
gh-119580: Improve version added section for convenience variable (#1…
gaogaotiantianMay 27, 2024
eea26c4
Docs: Move inline JavaScript to own file to reduce duplication (#119541)
hugovkMay 27, 2024
3ff06eb
Withdraw most of my ownership in favor of Mark (#119611)
gvanrossumMay 27, 2024
0bd0d40
Misc cleanups and wording improvements for the itertools docs (gh-119…
rhettingerMay 27, 2024
ae7b176
gh-119584: Fix test_import Failed Assertion (gh-119623)
ericsnowcurrentlyMay 27, 2024
3e8b609
gh-117398: Add multiphase support to _datetime (gh-119373)
erlend-aaslandMay 27, 2024
a9a74da
gh-119311: Fix name mangling with PEP 695 generic classes (#119464)
JelleZijlstraMay 28, 2024
bf08f0a
Fix typos in comments (#119645)
xybMay 28, 2024
b313cc6
gh-117557: Improve error messages when a string, bytes or bytearray o…
serhiy-storchakaMay 28, 2024
669175b
gh-116860: Remove outdated `test_parserhack` from `test_future` (#116…
sobolevnMay 28, 2024
b407ad3
[doc] Clarify the nature of the root logger in the `logging` document…
jkunimuneMay 28, 2024
f912e5a
gh-118824: Remove deprecated `master_open` and `slave_open` from `pty…
sobolevnMay 28, 2024
2da0dc0
gh-119659: Move `@no_rerun` to `test.support` (#119660)
sobolevnMay 28, 2024
0518edc
gh-119396: Optimize unicode_repr() (#119617)
vstinnerMay 28, 2024
6ec3712
gh-119581: Add a test of InitVar with name shadowing (#119582)
stroxlerMay 28, 2024
a89fc26
gh-117398: gh-119655: datetime: Init static state once & don't free i…
encukouMay 28, 2024
ae11d68
gh-117865: Defer import of re in ast (#119546)
JelleZijlstraMay 28, 2024
6b240c2
gh-119011: `type.__type_params__` now return an empty tuple (#119296)
sobolevnMay 28, 2024
ae9140f
gh-119676: remove several pseudo instructions which are use only in c…
iritkatrielMay 28, 2024
d87b015
gh-119118: Fix performance regression in tokenize module (#119615)
lysnikolaouMay 28, 2024
cfcc054
GH-119476: Split _CHECK_FUNCTION_VERSION out of _CHECK_FUNCTION_EXACT…
brandtbucherMay 28, 2024
5cd3ffd
GH-119258: Handle STORE_ATTR_WITH_HINT in tier two (GH-119481)
brandtbucherMay 28, 2024
606be66
gh-119538: Add missing expat build dependencies (#119647)
erlend-aaslandMay 28, 2024
548a11d
gh-117398: Convert datetime.IsoCalendarDate To A Heap Type (gh-119637)
ericsnowcurrentlyMay 28, 2024
a8e35e8
gh-119443: Turn off from __future__ import annotations in REPL (#119493)
JelleZijlstraMay 29, 2024
c0faade
gh-119704: Fix reference leak in the ``Python/Python-tokenize.c`` (#1…
Eclips4May 29, 2024
86d1a1a
gh-119555: catch SyntaxError from compile() in the InteractiveColored…
skirpichevMay 29, 2024
cd11ff1
gh-119613: Use C99+ functions instead of Py_IS_NAN/INFINITY/FINITE (#…
skirpichevMay 29, 2024
7ca74a7
gh-119661: Add _Py_SINGLETON() include in Argumenet Clinic (#119712)
vstinnerMay 29, 2024
c1e9647
gh-119689: generate stack effect metadata for pseudo instructions (#1…
iritkatrielMay 29, 2024
18c1a8d
gh-97588: Align ctypes struct layout to GCC/MSVC (GH-97702)
matthiasgoergensMay 29, 2024
016a46a
gh-93554: add test for quickening of code in loops ending with condit…
iritkatrielMay 29, 2024
0cdc5c8
gh-119613: Soft deprecate Py_IS_NAN/INFINITY/FINITE (#119701)
skirpichevMay 29, 2024
055c739
CI: set correct working directory for Hypothesis cache (GH-119345)
Zac-HDMay 29, 2024
1f481fd
gh-119273: Don't run test_ioctl in a process group (#119275)
vstinnerMay 29, 2024
34f9b3e
gh-119655: Fix reference leak in the ``_datetimemodule.c`` (gh-119713)
Eclips4May 29, 2024
78d697b
gh-119690: Adds Unicode support for named pipes in _winapi (GH-119717)
zoobaMay 29, 2024
659cb7e
gh-119721: Integrate documentation fixes into heapq module docstring.…
filiplajszczakMay 29, 2024
c8b45a3
gh-118673: Remove shebang and executable bits from stdlib modules. (#…
jaracoMay 29, 2024
0751511
gh-93963: Remove deprecated names from importlib.abc (#119720)
hugovkMay 29, 2024
bf4ff3a
gh-119260: Clarify is_dataclass Behavior for Subclasses in Documentat…
adiaholicMay 29, 2024
fcca08e
gh-119594: Improve pow(fraction.Fraction(), b, modulo) error message …
wimglennMay 29, 2024
df93f5d
gh-119070: Fix py.exe handling of /usr/bin/env commands missing exten…
zoobaMay 29, 2024
c22323c
gh-119525: Fix deadlock with `_PyType_Lookup` and the GIL (#119527)
colesburyMay 29, 2024
a150679
GH-89727: Partially fix `shutil.rmtree()` recursion error on deep tre…
barneygaleMay 29, 2024
7ff61f5
GH-119169: Implement `pathlib.Path.walk()` using `os.walk()` (#119573)
barneygaleMay 29, 2024
2cc3502
subprocess docs: Fix semantically important typo (GH-119752)
zwareMay 29, 2024
3c890b5
GH-89727: Fix `os.fwalk()` recursion error on deep trees (#119638)
barneygaleMay 30, 2024
a5fef80
GH-89727: Fix FD leak on `os.fwalk()` generator finalization. (#119766)
barneygaleMay 30, 2024
48f21b3
gh-118235: Move RAISE_SYNTAX_ERROR actions to invalid rules and make …
encukouMay 30, 2024
db00934
gh-118055: Update the finder glossary entry (GH-118278)
Lincoln-developerMay 30, 2024
b1374aa
gh-110383: Remove references to removed popen[234] (GH-112783)
shenanigansdMay 30, 2024
e50fac9
gh-119336: Restore removed _PyLong_NumBits() function (#119418)
emmatypingMay 30, 2024
6fb191b
gh-119779: Fix pyporting howto docs (#119785)
SweetyAngelMay 30, 2024
e91fc11
gh-119786: create folder in cpython repo for internals documentation …
iritkatrielMay 30, 2024
e875c2d
gh-119791: Fix new Tkinter tests for wantobjects=0 (GH-119792)
serhiy-storchakaMay 30, 2024
bf098d4
gh-109218: Refactor tests for the complex() constructor (GH-119635)
serhiy-storchakaMay 30, 2024
1c04c63
gh-119729: Use 't' in pkg-config file name for free-threaded build (#…
colesburyMay 30, 2024
ec1ba26
gh-109218: Improve documentation for the complex() constructor (GH-11…
serhiy-storchakaMay 30, 2024
deda857
Docs: `shutil.rmtree`'s `onerror` has no pending removal version (#11…
hugovkMay 30, 2024
ef01e95
gh-109218: Deprecate weird cases in the complex() constructor (GH-119…
serhiy-storchakaMay 30, 2024
9732ed5
gh-107262: Update Tkinter tests for Tcl/Tk 8.6.14 (GH-119322)
DBJimMay 30, 2024
13a5fdc
gh-119744: move a few functions from compile.c to flowgraph.c (#119745)
iritkatrielMay 30, 2024
38d9c11
better variable names and mini corrections
dg-pbMay 31, 2024
39a18f8
Initial Implementation
dg-pbMay 21, 2024
ee0e1f3
serialization fix
dg-pbMay 21, 2024
353ac4d
bug fix
dg-pbMay 21, 2024
d287026
Bug 2 fix
dg-pbMay 21, 2024
df8ea4c
Py_TPFLAGS_IMMUTABLETYPE added
dg-pbMay 21, 2024
0081cbd
placeholder added to state as opposed to being used as global constant
dg-pbMay 23, 2024
4b329cd
static removed
dg-pbMay 23, 2024
1669ca7
creating sentinel via PyType_Spec
dg-pbMay 23, 2024
becd259
more accurate variable name
dg-pbMay 23, 2024
6953ab7
trailing trim bug and tests
dg-pbMay 24, 2024
544f774
Updated docs
dg-pbMay 24, 2024
ce45640
blurb
dg-pbMay 24, 2024
38e0ab7
minor edit
dg-pbMay 24, 2024
1a5d45f
doc fix
dg-pbMay 24, 2024
f5118bd
better variable names and mini corrections. Rebase
dg-pbMay 31, 2024
73531ea
merge to main
dg-pbMay 31, 2024
980383f
Merge remote-tracking branch 'origin/implement-119127' into implement…
dg-pbMay 31, 2024
5a3c478
..
dg-pbMay 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
creating sentinel via PyType_Spec
  • Loading branch information
@dg-pb
dg-pb committedMay 23, 2024
commit607a0b1a90bb0a358357ffe102c26329d230d26b
33 changes: 20 additions & 13 deletionsModules/_functoolsmodule.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ class _functools._lru_cache_wrapper "PyObject *" "&lru_cache_type_spec"
typedef struct _functools_state {
/* this object is used delimit args and keywords in the cache keys */
PyObject *kwd_mark;
PyObject *placeholder;
PyTypeObject *placeholder;
PyTypeObject *partial_type;
PyTypeObject *keyobject_type;
PyTypeObject *lru_list_elem_type;
Expand All@@ -48,15 +48,21 @@ typedef struct {
} placeholderobject;


PyTypeObject placeholder_type = {
.ob_base = PyVarObject_HEAD_INIT(NULL, 0)
.tp_name = "functools.Placeholder",
.tp_doc = PyDoc_STR("placeholder for partial arguments"),
.tp_basicsize = sizeof(placeholderobject),
.tp_itemsize = 0,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE |
Py_TPFLAGS_DISALLOW_INSTANTIATION,
.tp_new = PyType_GenericNew,
PyDoc_STRVAR(placeholder_doc, "placeholder for partial class");


static PyType_Slot placeholder_type_slots[] = {
{Py_tp_doc, (void *)placeholder_doc},
{0, 0}
};

static PyType_Spec placeholder_type_spec = {
.name = "partial2.Placeholder",
.basicsize = sizeof(placeholderobject),
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
Py_TPFLAGS_IMMUTABLETYPE |
Py_TPFLAGS_DISALLOW_INSTANTIATION,
.slots = placeholder_type_slots
};


Expand DownExpand Up@@ -144,7 +150,7 @@ partial_new(PyTypeObject *type, PyObject *args, PyObject *kw)
return NULL;
}

pto->placeholder = state->placeholder;
pto->placeholder =(PyObject *)state->placeholder;
Py_ssize_t nnp = 0;
Py_ssize_t nnargs = PyTuple_GET_SIZE(nargs);
PyObject *item;
Expand DownExpand Up@@ -1620,11 +1626,12 @@ _functools_exec(PyObject *module)
return -1;
}

state->placeholder = (PyObject *)&placeholder_type;
state->placeholder = (PyTypeObject *)PyType_FromModuleAndSpec(module,
&placeholder_type_spec, NULL);
if (state->placeholder == NULL) {
return -1;
}
if (PyModule_AddType(module,&placeholder_type) < 0) {
if (PyModule_AddType(module,state->placeholder) < 0) {
return -1;
}

Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp