Oren Milman added the comment:
How do we proceed?
should I update (if needed) each of the patches I uploaded in March
to eliminate commit conflicts? or can someone review them as they are
now?
--
___
Python tracker
<http://bugs.python.org/issue15
New submission from Oren Milman:
in listobject.c, in case list_extend() receives an 'iterable' which isn't 'self'
nor a tuple nor a list, we have the following (heavily edited for brevity):
mn = Py_SIZE(self) + PyObject_LengthHint(iterable);
list_resize(self,
New submission from Oren Milman:
in Objects/object.c, Py_ReprEnter() does the following:
- try to retrieve the Py_Repr list from the thread-state dict.
- in case the list is not in the dict, add it to the dict as an empty list.
- check whether the received object is in the Py_Repr
Changes by Oren Milman :
--
title: a mostly useless check in list_extend() -> a suboptimal check in
list_extend()
___
Python tracker
<http://bugs.python.org/issu
Oren Milman added the comment:
thank you for the elaborate reply :)
do you feel the same about changing the check to
(Py_SIZE(self) < (self->allocated >> 1)) ?
--
___
Python tracker
<http://bugs.python
Oren Milman added the comment:
I replied to your comments in Rietveld, Serhiy.
(http://bugs.python.org/review/28261)
also, i found two places with a quite similar issue:
- in Objects/exceptions.c in ImportError_init:
>>> ImportError(1, 2, 3, 4, a=5, b=6, c=7)
Traceback (mo
Oren Milman added the comment:
After more looking, I found this issue in two more places:
- in Modules/itertoolsmodule.c in product_new:
>>> itertools.product(0, a=1, b=2, c=3, d=4, e=5, f=6)
Traceback (most recent call last):
File "", line 1, in
TypeError:
Changes by Oren Milman :
--
title: Deprecated silent truncations in socket.htons and socket.ntohs. ->
silent truncations in socket.htons and socket.ntohs
___
Python tracker
<http://bugs.python.org/issu
Changes by Oren Milman :
--
title: silent truncations in socket.htons and socket.ntohs -> keyword arguments
___
Python tracker
<http://bugs.python.org/issu
Changes by Oren Milman :
--
title: keyword arguments -> Deprecated silent truncations in socket.htons and
socket.ntohs.
___
Python tracker
<http://bugs.python.org/issu
Changes by Oren Milman :
--
pull_requests: +3157
___
Python tracker
<http://bugs.python.org/issue28261>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Oren Milman:
Some functions produce wrong error messages in case they receive too many
keyword arguments:
- in Objects/exceptions.c - ImportError_init:
>>> ImportError(1, 2, 3, 4, a=5, b=6, c=7)
TypeError: ImportError() takes at most 2 arguments (3 given)
-
Changes by Oren Milman :
--
keywords: +patch
Added file: http://bugs.python.org/file47091/issue31229_ver1.diff
___
Python tracker
<http://bugs.python.org/issue31
New submission from Oren Milman:
currently, we have the following:
>>> min(0, a=1)
TypeError: 'a' is an invalid keyword argument for this function
>>> max(0, a=1)
TypeError: 'a' is an invalid keyword argument for this function
>>>
Changes by Oren Milman :
--
pull_requests: +3181
___
Python tracker
<http://bugs.python.org/issue31236>
___
___
Python-bugs-list mailing list
Unsubscribe:
Oren Milman added the comment:
I am not sure I understood your question, Igor.
I compiled with https://github.com/python/cpython/pull/3006, and got:
class T(ctypes.Array):
_type_ = ctypes.c_int
_length_ = 2 ** 1000
Traceback (most recent call last):
File "&quo
Changes by Oren Milman :
--
pull_requests: +3199
___
Python tracker
<http://bugs.python.org/issue29832>
___
___
Python-bugs-list mailing list
Unsubscribe:
Oren Milman added the comment:
here is a dirty script to test my PR.
the script contains tests to anything I managed to test using my
Windows 10 and Ubuntu 16.04 VM, i.e. all of the changes, except for
the 'unsupported CAN protocol' message, and the changes of the code
that h
New submission from Oren Milman:
according to the docs
(https://docs.python.org/3.7/c-api/arg.html?highlight=pyarg_parsetuple#c.PyArg_ParseTuple),
PyArg_ParseTuple
returns true for success or false for failure. I also looked at the
implementation in Python/getargs.c, and it seems that indeed
Oren Milman added the comment:
it seems that I have missed some places which are part of this issue, at least
in Modules/_io/textio.c (one of them is mentioned in #31243).
also, when fixing these, we should also add a check before the call to
PyArg_ParseTuple (in case such check doesn't al
Oren Milman added the comment:
yes, soon.
(just wanted to hear your opinion before doing that.)
--
___
Python tracker
<http://bugs.python.org/issue31243>
___
___
Oren Milman added the comment:
I already wrote a patch, but I thought it would be better to wait until
#31236 is resolved.
this is because #31236 would change the error messages of min() and max(), and
test_call tests exact error messages in
CFunctionCallsErrorMessages, which is where I thought
Changes by Oren Milman :
--
pull_requests: +3208
___
Python tracker
<http://bugs.python.org/issue31243>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Oren Milman :
--
pull_requests: +3218
___
Python tracker
<http://bugs.python.org/issue31229>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Oren Milman :
--
pull_requests: +3237
___
Python tracker
<http://bugs.python.org/issue28261>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Oren Milman:
currently, the following causes an assertion in Modules/_io/textio.c in
_io_TextIOWrapper_write_impl() to fail:
import codecs
import io
class BadEncoder():
def encode(self, dummy):
return 42
def _get_bad_encoder(dummy):
return BadEncoder
Changes by Oren Milman :
--
pull_requests: +3240
___
Python tracker
<http://bugs.python.org/issue31271>
___
___
Python-bugs-list mailing list
Unsubscribe:
Oren Milman added the comment:
Just checked on current 3.6 on my Windows 10.
The assertion failes, and it is in line 1337.
oh my.
--
___
Python tracker
<http://bugs.python.org/issue31
Oren Milman added the comment:
As Serhiy pointed out on github, the assertion failure can be easily reproduced
by the following:
import codecs
import io
rot13 = codecs.lookup("rot13")
rot13._is_text_encoding = True
t = io.TextIOWrapper(io.BytesIO(b'foo'), encoding=&
Oren Milman added the comment:
sure
--
___
Python tracker
<http://bugs.python.org/issue28261>
___
___
Python-bugs-list mailing list
Unsubscribe:
https://mail.pyth
Oren Milman added the comment:
all three versions do 'self->pending_bytes_count += PyBytes_GET_SIZE(b);',
while 'b' is the object the encoder returned.
in 3.6 and 3.7, the implementation of PyBytes_GET_SIZE() includes
'assert(PyBytes_Check(op))',
Changes by Oren Milman :
--
pull_requests: +3247
___
Python tracker
<http://bugs.python.org/issue31271>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Oren Milman :
--
pull_requests: +3248
___
Python tracker
<http://bugs.python.org/issue28261>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Oren Milman :
--
pull_requests: +3251
___
Python tracker
<http://bugs.python.org/issue28261>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Oren Milman:
1.
the following causes an assertion failure in Python/_warnings.c in
show_warning():
import warnings
class BadLoader:
def get_source(self, fullname):
class BadSource:
def splitlines(self):
return [42]
return
Oren Milman added the comment:
on a second thought, BadSource could be a subclass of str, so maybe we
should just check whether
module_globals['__loader__'].get_source(module_globals['__name__']).splitlines()[lineno-1]
is a str,
and whether
module_globals['__loader__
Changes by Oren Milman :
--
pull_requests: +3259
___
Python tracker
<http://bugs.python.org/issue31285>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Oren Milman:
on Windows, assuming the file 'foo.zip' exists, the following would cause an
assertion failure in Modules/zipimport.c in
zipimport_zipimporter_get_data_impl():
import zipimport
class BadStr(str):
def replace(self, old, new):
Changes by Oren Milman :
--
pull_requests: +3269
___
Python tracker
<http://bugs.python.org/issue31291>
___
___
Python-bugs-list mailing list
Unsubscribe:
Oren Milman added the comment:
ISTM that your solution is better than mine, Serhiy, so I updated the PR.
--
___
Python tracker
<http://bugs.python.org/issue31
New submission from Oren Milman:
both of the following true division and multiplication operations crash the
interpreter:
import datetime
class BadFloat(float):
def as_integer_ratio(self):
return (1 << 1000) - 1
datetime.timedelta() / BadFloat()
datetime.timedelta() * Ba
Oren Milman added the comment:
i am working on a patch.
BTW, is there anywhere a list of what counts as an extension
module, and what counts as the interpreter core?
--
___
Python tracker
<http://bugs.python.org/issue31
Changes by Oren Milman :
--
pull_requests: +3270
___
Python tracker
<http://bugs.python.org/issue31293>
___
___
Python-bugs-list mailing list
Unsubscribe:
Oren Milman added the comment:
I guess you meant for me to check whether the following has any problem:
import decimal
class BadFloat(float):
def as_integer_ratio(self):
return 1 << 1000
decimal.Decimal.from_float(BadFloat())
so it doesn't crash.
if IIUC, this is be
Oren Milman added the comment:
I understand that our goal is to make Python better, not to make me happier :)
anyway, I haven't checked, but I am quite sure that similar code might
crash the interpreter on a release build of Python.
(just wanted to clarify that, as you used the term '
Oren Milman added the comment:
just checked, and indeed on my Windows 10 the original code I posted here
crashes the interpreter.
The patch in the PR undermines duck-typing, and that's why I added a comment
there, stating I wasn't sure about the patch.
an alternate solution would be
Changes by Oren Milman :
--
pull_requests: +3275
___
Python tracker
<http://bugs.python.org/issue31243>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Oren Milman :
--
pull_requests: +3276
___
Python tracker
<http://bugs.python.org/issue31243>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Oren Milman :
--
pull_requests: +3287
___
Python tracker
<http://bugs.python.org/issue31291>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Oren Milman:
The following code causes PyCData_setstate() (in Modules/_ctypes/_ctypes.c) to
raise a SystemError:
import ctypes
class BadStruct(ctypes.Structure):
def __dict__(self):
pass
BadStruct().__setstate__({}, b'foo')
this is because PyCDat
Oren Milman added the comment:
typo - change the format to "O!s#"
--
___
Python tracker
<http://bugs.python.org/issue31311>
___
___
Python-bugs-l
Changes by Oren Milman :
--
title: SystemError raised by PyCData_setstate() in case __dict__ is not a dict
-> a SystemError and a crash in PyCData_setstate() when __dict__ is bad
___
Python tracker
<http://bugs.python.org/issu
Changes by Oren Milman :
--
pull_requests: +3298
___
Python tracker
<http://bugs.python.org/issue31311>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Oren Milman :
--
pull_requests: +3299
___
Python tracker
<http://bugs.python.org/issue31311>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Oren Milman :
--
components: +ctypes -Extension Modules
___
Python tracker
<http://bugs.python.org/issue31311>
___
___
Python-bugs-list mailin
New submission from Oren Milman:
The following code causes an assertion failure in get_encoded_name(), which is
called by _PyImport_LoadDynamicModuleWithSpec() (in Python/importdl.c):
import imp
class BadSpec:
name = 42
origin = 'foo'
imp.create_dynamic(BadSpec())
this
Oren Milman added the comment:
do you mean that we should fix it to raise a TypeError?
the assertion is there, but not explicitly.
get_encoded_name() calls PyUnicode_FindChar(), which calls
PyUnicode_READY(), which does assert(_PyUnicode_CHECK).
so i get:
>>> import imp
>>>
Changes by Oren Milman :
--
pull_requests: +3301
___
Python tracker
<http://bugs.python.org/issue31315>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Oren Milman:
at least on my Windows, the following code:
import sys
sys.modules = []
- when run interactively, causes weird behavior, e.g. exit() doesn't exit the
interpreter, and print() doesn't print.
then, pressing Ctrl+C causes 'Assertion failed:
Oren Milman added the comment:
just in case it was missed - I have opened two PRs for this issue.
--
___
Python tracker
<https://bugs.python.org/issue31
New submission from Oren Milman:
The following code crashes the interpreter:
import decimal
import fractions
class BadRational(fractions.Fraction):
numerator = None
denominator = 42
decimal.Decimal() < BadRational()
this is because numerator_as_decimal() (in Modules/_deci
Changes by Oren Milman :
--
keywords: +patch
pull_requests: +3467
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue31406>
___
___
Py
New submission from Oren Milman:
The following code causes warn_explicit() (in Python/_warnings.c) to raise a
SystemError:
import warnings
warnings.filterwarnings('once')
warnings.onceregistry = None
warnings.warn_explicit(message='foo', category=Wa
Changes by Oren Milman :
--
keywords: +patch
pull_requests: +3475
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue31411>
___
___
Py
New submission from Oren Milman:
The following code causes an assertion failure in warn_explicit() (in
Python/_warnings.c):
import warnings
warnings.filters = [(None, None, Warning, None, 0)]
warnings.warn_explicit(message='foo', category=Warning, filename='bar',
Changes by Oren Milman :
--
keywords: +patch
pull_requests: +3489
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue31416>
___
___
Py
New submission from Oren Milman:
The following code causes an assertion failure in PyErr_WriteUnraisable() (in
Python/errors.c):
class BadException(Exception):
__module__ = None
class BadClass:
def __del__(self):
raise BadException
foo = BadClass()
del foo
this is because
New submission from Oren Milman:
The following code causes ElementTree.Element.__deepcopy__() to raise a
SystemError:
class BadMemo:
def get(*args):
return None
import xml.etree.ElementTree
xml.etree.ElementTree.Element('foo').__deepcopy__(BadMemo())
this
Changes by Oren Milman :
--
keywords: +patch
pull_requests: +3507
stage: needs patch -> patch review
___
Python tracker
<https://bugs.python.org/issu
New submission from Oren Milman:
the following code causes an assertion failure on my Windows:
import io
def _bad_open(*args):
return 42
io.open = _bad_open
1/0
this is because _Py_DisplaySourceLine() (in Python/traceback.c) assumes that
the return value of io.open() is valid.
IIUC, this
New submission from Oren Milman:
the following code causes a ResourceWarning:
import io
def _bad_TextIOWrapper(*args):
return None
io.TextIOWrapper = _bad_TextIOWrapper
1/0
this is because _Py_DisplaySourceLine() (in Python/traceback.c) assumes that
io.TextIOWrapper() returned a stream
Oren Milman added the comment:
what do you mean by 'Implicit converting to str can raise a warning or
exception if __module__ is a bytes object.'?
should we treat __module__ differently in case it is a bytes object?
--
___
Python track
Changes by Oren Milman :
--
keywords: +patch
pull_requests: +3534
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue31418>
___
___
Py
New submission from Oren Milman:
The following code causes an assertion failure on Windows:
class BadEnv(dict):
keys = None
import subprocess
import sys
subprocess.Popen([sys.executable, "-c", "pass"], env=BadEnv())
this is because getenvironment() (in Modu
Changes by Oren Milman :
--
keywords: +patch
pull_requests: +3570
stage: needs patch -> patch review
___
Python tracker
<https://bugs.python.org/issu
New submission from Oren Milman:
The following code causes an assertion failure:
class BadInt(int):
def __abs__(self):
return None
import random
random.seed(BadInt())
this is because random_seed() (in Modules/_randommodule.c) assumes that
PyNumber_Absolute() returned an int, and
Oren Milman added the comment:
in 2.7 getenvironment() is in PC/_subprocess.c, and it also calls
PyMapping_Values()
immediately after calling PyMapping_Keys().
however, _PyObject_FastCallDict() doesn't exist here.
in case of an error in both PyMapping_Keys() and PyMapping_Values(), the
err
Oren Milman added the comment:
sure.
but what about the TypeError message? should it complain about
the return value of abs(seed)? (the docs of random.seed don't mention abs().)
--
___
Python tracker
<https://bugs.python.org/is
Oren Milman added the comment:
OK.
but there isn't an assertion failure to test in 2.7, so is adding a test
still relevant?
--
___
Python tracker
<https://bugs.python.org/is
Changes by Oren Milman :
--
pull_requests: +3586
___
Python tracker
<https://bugs.python.org/issue31471>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Oren Milman :
--
keywords: +patch
pull_requests: +3587
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue31478>
___
___
Py
Oren Milman added the comment:
i opened a PR that implements the first option, but of course I wouldn't
mind if you decide another option is better.
--
___
Python tracker
<https://bugs.python.org/is
New submission from Oren Milman:
the following code causes a SystemError:
import json.encoder
class BadDict(dict):
def items(self):
return ()
encoder = json.encoder.c_make_encoder(None, None, None, None, 'foo', 'bar',
True,
New submission from Oren Milman:
The following code causes an assertion failure:
import ctypes
class BadStruct(ctypes.Structure):
_fields_ = []
_anonymous_ = ['foo']
foo = None
this is because MakeAnonFields() (in Modules/_ctypes/stgdict.c) goes over the
names sp
Changes by Oren Milman :
--
keywords: +patch
pull_requests: +3606
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue31490>
___
___
Py
New submission from Oren Milman:
The following code causes an assertion failure:
import os
os.__name__ = None
os.does_not_exist
this is because module_getattro() (in Objects/moduleobject.c) assumes that
__name__ is a string, and passes it to PyErr_Format(), which asserts it is a
string.
if we
Changes by Oren Milman :
--
components: +Interpreter Core -Extension Modules
___
Python tracker
<https://bugs.python.org/issue31492>
___
___
Python-bugs-list m
Changes by Oren Milman :
--
keywords: +patch
pull_requests: +3611
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue31492>
___
___
Py
New submission from Oren Milman:
The following code causes an assertion failure:
import _json
def _bad_encoder(*args):
return None
enc = _json.make_encoder(None, None, _bad_encoder, None,
'foo', 'bar', None, None, None)
enc(obj='spam&
Changes by Oren Milman :
--
title: assertion failure in _json.make_encoder() in case of a bad encoder()
argument -> assertion failure in json, in case _json.make_encoder() received a
bad encoder() argument
___
Python tracker
<
Changes by Oren Milman :
--
keywords: +patch
pull_requests: +3638
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue31505>
___
___
Py
New submission from Oren Milman:
The following code causes the interpreter to crash (in case 'foo.zip' exists):
import zipimport
zipimport._zip_directory_cache['foo.zip'] = None
importer = zipimport.zipimporter('foo.zip')
importer.find_
New submission from Oren Milman:
I am not sure whether such a platform exists, but on a platform where
SIZEOF_VOID_P < SIZEOF_LONG, PyLong_AsVoidPtr (which is in
Objects/longobject.c) is:
long x;
if (PyLong_Check(vv) && _PyLong_Sign(vv) < 0)
x = PyLong_AsLong
New submission from Oren Milman:
current state
if (PyNumber_Check(obj)) {
someVar = PyNumber_AsSsize_t(obj, SomeError);
if (someVar == -1 && PyErr_Occurred()) {
return errVal;
}
}
else {
PyErr_Format(PyExc_TypeError,
New submission from Oren Milman:
current state
import io
class IntLike():
def __init__(self, num):
self._num = num
def __index__(self):
return self._num
__int__ = __index__
io.StringIO('blah blah').read(IntLike(2))
io.StringIO(
Oren Milman added the comment:
I don't have a use case for that. (I noticed this behavior by
chance, while working on some other issue.)
However, IIUC, commit 4fa88fa0ba35e25ad9be66ebbdaba9aca553dc8b,
by Benjamin Peterson, Antoine Pitrou and Amaury Forgeot d'Arc,
includes pa
Oren Milman added the comment:
using _PyIO_ConvertSsize_t sounds great.
with regard to tests for accepting integer types in other classes,
there aren't a lot of them, so I guess it is not always tested.
still, it is tested in (excluding tests of the actual feature of
treating integer typ
Oren Milman added the comment:
also with regard to adding tests, consider the following scenario:
in the future, someone writes a patch for these functions, which
makes them not accept integer types anymore.
assuming the tests don't exist, the writer of the patch doesn't
realize the p
Oren Milman added the comment:
I wrote a patch, but I attach it here and not in a PR, as you haven't approved
adding tests. (I would be happy to open a PR with or without the tests.)
I ran the test module (on my Windows 10), and seems like the patch doesn't
break anything.
also, whi
Oren Milman added the comment:
should I open a PR (even though we didn't give Florent enough time to
respond)?
--
___
Python tracker
<http://bugs.python.org/is
1 - 100 of 357 matches
Mail list logo