Skip to content

gh-119793: Add optional length-checking to map() #120471

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 45 commits into from
Nov 4, 2024
Merged
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
06fdd71
Add `strict` argument
nineteendo Jun 13, 2024
a7966f8
📜🤖 Added by blurb_it.
blurb-it[bot] Jun 13, 2024
89e25d9
Add tests
nineteendo Jun 13, 2024
a48ebcf
Update commented out code
nineteendo Jun 13, 2024
e4ee2fb
Update docs
nineteendo Jun 13, 2024
bdd0fcb
Fix `__reduce__()`
nineteendo Jun 13, 2024
91a8450
Revert `map_vectorcall()`
nineteendo Jun 14, 2024
2c7d524
Reduce diff
nineteendo Jun 14, 2024
5ad7eb2
Never set
nineteendo Jun 14, 2024
6d8584b
Reduce diff 2
nineteendo Jun 14, 2024
e436a2b
Fixed undefined variable
nineteendo Jun 14, 2024
f9a2a49
Apply suggestions from code review
nineteendo Jun 14, 2024
800ac10
Merge branch 'main' into strict-map
nineteendo Jun 19, 2024
301da5d
Update 2024-06-13-19-12-49.gh-issue-119793.FDVCDk.rst
nineteendo Jun 19, 2024
fb1c379
Update whatsnew
nineteendo Jun 19, 2024
255e3a2
Fix pr number
nineteendo Jun 19, 2024
d1c1769
Fix signature
nineteendo Jun 19, 2024
6d20976
Add comment
nineteendo Jun 19, 2024
c338c8f
Add comment 2
nineteendo Jun 19, 2024
99d9c75
Fix typo
nineteendo Jun 19, 2024
63522b3
Update Doc/library/functions.rst
nineteendo Jun 19, 2024
fcb438f
Match news entry of `zip()`
nineteendo Jun 19, 2024
6e97e31
Fix trailing whitespace
nineteendo Jun 19, 2024
54231e0
Update 2024-06-13-19-12-49.gh-issue-119793.FDVCDk.rst
nineteendo Jun 24, 2024
b5e8ac4
Update 2024-06-13-19-12-49.gh-issue-119793.FDVCDk.rst
nineteendo Jun 24, 2024
53f3f58
Remove pep reference
nineteendo Sep 4, 2024
a2fe008
Merge branch 'main' into strict-map
nineteendo Sep 28, 2024
9a2c0fd
Make tests more maintainable
nineteendo Oct 3, 2024
f75e511
Update Python/bltinmodule.c
nineteendo Oct 10, 2024
92134e7
Update Python/bltinmodule.c
nineteendo Oct 10, 2024
e74c3ff
Use correct variable
nineteendo Oct 10, 2024
bf7f350
Update Python/bltinmodule.c
nineteendo Oct 31, 2024
9cc41f2
Rename 2024-06-13-19-12-49.gh-issue-119793.FDVCDk.rst to 2024-06-13-1…
nineteendo Oct 31, 2024
f686101
Fix shadowed variable
nineteendo Oct 31, 2024
e524e17
Apply suggestions from code review
nineteendo Oct 31, 2024
91bdf2f
Rename 2024-06-13-19-12-49.gh-issue-119793.FDVCDk.rst to 2024-06-13-1…
nineteendo Oct 31, 2024
39c34f1
Use same message for news.d
nineteendo Oct 31, 2024
ea65b2c
Update Doc/whatsnew/3.14.rst
nineteendo Oct 31, 2024
45c2d0d
Apply suggestions from code review
nineteendo Oct 31, 2024
ad6c2a5
Sync with what's new
nineteendo Oct 31, 2024
9ebc398
Accept truthy value in setstate
nineteendo Oct 31, 2024
d829a17
Fix removed line
nineteendo Oct 31, 2024
d1d858f
Use stdbool
nineteendo Oct 31, 2024
f23caa5
Revert "Use stdbool"
nineteendo Oct 31, 2024
7e32e2c
Apply suggestions from code review
nineteendo Nov 1, 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
Prev Previous commit
Next Next commit
Use stdbool
  • Loading branch information
nineteendo committed Oct 31, 2024
commit d1d858fc7161a8f9d428d927e8128dd3bc8e920e
11 changes: 6 additions & 5 deletions Python/bltinmodule.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* Built-in functions */

#include <stdbool.h>
#include "Python.h"
#include "pycore_ast.h" // _PyAST_Validate()
#include "pycore_call.h" // _PyObject_CallNoArgs()
Expand Down Expand Up @@ -1303,7 +1304,7 @@ typedef struct {
PyObject_HEAD
PyObject *iters;
PyObject *func;
int strict;
bool strict;
} mapobject;

static PyObject *
Expand All @@ -1312,7 +1313,7 @@ map_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
PyObject *it, *iters, *func;
mapobject *lz;
Py_ssize_t numargs, i;
int strict = 0;
bool strict = false;

if (kwds) {
PyObject *empty = PyTuple_New(0);
Expand Down Expand Up @@ -1403,7 +1404,7 @@ map_vectorcall(PyObject *type, PyObject * const*args,
}
lz->iters = iters;
lz->func = Py_NewRef(args[0]);
lz->strict = 0;
lz->strict = false;

return (PyObject *)lz;
}
Expand Down Expand Up @@ -2950,7 +2951,7 @@ typedef struct {
Py_ssize_t tuplesize;
PyObject *ittuple; /* tuple of iterators */
PyObject *result;
int strict;
bool strict;
} zipobject;

static PyObject *
Expand All @@ -2961,7 +2962,7 @@ zip_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
PyObject *ittuple; /* tuple of iterators */
PyObject *result;
Py_ssize_t tuplesize;
int strict = 0;
bool strict = false;

if (kwds) {
PyObject *empty = PyTuple_New(0);
Expand Down
Loading