[issue28491] Remove bundled libffi for OSX

2017-03-15 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

Update: my pull request at https://github.com/libffi/libffi/pull/288 is merged. 
Future libffi releases don't need pkg-config anymore. However, I guess the 
system copy won't be updated in near future.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29823] mimetypes guesses XSL mimetype when passed an XML file

2017-03-15 Thread Martin Panter

Martin Panter added the comment:

Perhaps a duplicate of Issue 1043134?

--
nosy: +martin.panter
superseder:  -> Add preferred extensions for MIME types
versions:  -Python 3.3, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29823] mimetypes guesses XSL mimetype when passed an XML file

2017-03-15 Thread Aleksey Bilogur

Changes by Aleksey Bilogur :


--
title: ython guesses XSL mimetype when passed an XML file -> mimetypes guesses 
XSL mimetype when passed an XML file

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29823] ython guesses XSL mimetype when passed an XML file

2017-03-15 Thread Aleksey Bilogur

New submission from Aleksey Bilogur:

Copied over from an unanswered StackOverflow thread 
(http://stackoverflow.com/questions/42542433/why-does-python-mimetype-guess-xsl-when-passed-an-xml-file):

When passed a file with a mimetype application/xml, the Python std lib 
mimetypes.guess_extension method guesses an .xsl extension. This is actually 
hard-coded in.

This seems wrong to me. But what do I know?

--
components: Library (Lib)
messages: 289705
nosy: Aleksey Bilogur
priority: normal
severity: normal
status: open
title: ython guesses XSL mimetype when passed an XML file
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29812] test for token.py, and consistency tests for tokenize.py

2017-03-15 Thread R. David Murray

R. David Murray added the comment:

The cross check test itself doesn't depend on a regeneration, but it does 
depend on the information in token.h.  Meanwhile the validity of *that* is 
checked by regeneration in your test_token tests.  This is exactly what I had 
in mind :).

So, I haven't done a full review, but the quick glance I took looked good.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29813] PyTuple_GetSlice does not always return a new tuple

2017-03-15 Thread Michael Seifert

Michael Seifert added the comment:

I rather thought about something along the lines of: "Take a slice of the tuple 
pointed to by *p* from *low* to *high* and return it as a tuple. Whether the 
returned tuple is new or not is an implementation detail (and may depend on the 
value of the arguments)." Because from the point of the C-API tuples aren't 
immutable, at least not if they are new (refcount 1).

Thank you both for your feedback. I'll leave it closed as "not a bug", I got 
the point about over-explaining. :)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29812] test for token.py, and consistency tests for tokenize.py

2017-03-15 Thread Ammar Askar

Ammar Askar added the comment:

This is my first real substantial testing change so I'd appreciate all 
feedback. The way I did the cross-check doesn't actually rely on any of the 
information from the test_keyword style regeneration test. 

I think this approach is a lot simpler, and will prevent mistakes like the one 
seen in http://bugs.python.org/issue24622

--
nosy: +ammar2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29812] test for token.py, and consistency tests for tokenize.py

2017-03-15 Thread Ammar Askar

Changes by Ammar Askar :


--
pull_requests: +558

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29639] test suite intentionally avoids referring to localhost, destroying abstraction away from IPv6 vs IPv4

2017-03-15 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
assignee:  -> gregory.p.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29821] importing module shutil executes file 'copy.py'

2017-03-15 Thread Eryk Sun

Eryk Sun added the comment:

> Run "python3 -I script.py" to not insert '' (current directory) 
> at the first position of sys.path.

That should be "script directory", not "current directory". We only add the 
current directory to sys.path in interactive mode, and for -c and -m. Adding 
the current directory to sys.path when running a script would be silly and 
cause endless grief.

--
nosy: +eryksun

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29821] importing module shutil executes file 'copy.py'

2017-03-15 Thread STINNER Victor

STINNER Victor added the comment:

Run "python3 -I script.py" to not insert '' (current directory) at the first 
position of sys.path.
https://docs.python.org/dev/using/cmdline.html#cmdoption-I

--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29821] importing module shutil executes file 'copy.py'

2017-03-15 Thread Ammar Askar

Ammar Askar added the comment:

As per discussion with haypo on irc, this is not a bug since essentially you've 
made a file which shadows the following stdlib module 
https://docs.python.org/3/library/copy.html

When shutil goes to import the copy module, your copy module is given higher 
priority in the import machinery which is why your code gets executed. You can 
read up more about this here: 
http://python-notes.curiousefficiency.org/en/latest/python_concepts/import_traps.html#the-name-shadowing-trap

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29816] Get rid of C limitation for shift count in right shift

2017-03-15 Thread Oren Milman

Oren Milman added the comment:

i played a little with a patch earlier today, but stopped because I
am short on time.

anyway, just in case my code is not totally rubbish, I attach my
patch draft, which should avoid OverflowError also for big positive
ints.

(of course, I don't suggest to use my code instead of PR 680. I just
put it here in case it might be useful for someone.)

(on my Windows 10, it passed some manual tests by me, and the test
module (except for test_venv, which fails also without the patch))

--
keywords: +patch
Added file: http://bugs.python.org/file46727/patchDraft1.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29821] importing module shutil executes file 'copy.py'

2017-03-15 Thread Ammar Askar

Ammar Askar added the comment:

I was only able to recreate this under 3.4 and 3.3, and both of them are under 
"security" status on https://docs.python.org/devguide/#status-of-python-branches

Should this be marked as won't fix?

--
nosy: +ammar2
versions: +Python 3.3, Python 3.4 -Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27400] Datetime NoneType after calling Py_Finalize and Py_Initialize

2017-03-15 Thread Nathan Jensen

Changes by Nathan Jensen :


--
nosy: +Nathan Jensen

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15988] Inconsistency in overflow error messages of integer argument

2017-03-15 Thread Oren Milman

Oren Milman added the comment:

I am sorry, but my 2nd term starts on Monday, so I am short on time,
and feel like I would be lucky to even finish working on PR 668.

because of that, and because you obviously have a much better
understanding of this issue than me, I would be happy if you could open
the new issues.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29104] Left bracket remains in format string result when '\' preceeds it

2017-03-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Ryan. I already created a PR, but I think your recipe can be helpful 
for me in future.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15988] Inconsistency in overflow error messages of integer argument

2017-03-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I agree. It would be better to remove from the PR changes that can be covered 
by issue29816, issue29819 and other changes that changes visible behavior and 
open one or several new issues for them. Maybe one meta-issue and few concrete 
issues?

Such methods as read() also shouldn't raise OverflowError for negative argument.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29816] Get rid of C limitation for shift count in right shift

2017-03-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Unfortunately it is hard to totally avoid OverflowError in right shift. Righ 
shift of huge positive value can get non-zero result even if shift count is 
larger than PY_SSIZE_T_MAX. PR 680 just decreases the opportunity of getting a 
OverflowError.

--
stage: needs patch -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15988] Inconsistency in overflow error messages of integer argument

2017-03-15 Thread Oren Milman

Oren Milman added the comment:

also, IMHO, we should open an issue named 'raise ValueError instead of 
OverflowError when a negative int is invalid', and leave for that
new issue some the changes (which you commented about in the PR).

I didn't want to open it without your approval.
here is what I thought should be the contents of the issue (feel
free to edit my draft as you wish and open the issue yourself,
if you think we should open it):


In various C functions, a negative int argument is invalid. in most of these
functions, ValueError is raised for a negative int, or at least for a small
negative int (i.e. a negative int that fits in some signed integer C
type).

as Serhiy mentioned in http://bugs.python.org/issue15988#msg289679 and in
code review comments in https://github.com/python/cpython/pull/668, it might
be that a ValueError should always be raised in such functions, upon receiving
a negative int (even upon receiving a big negative int, such as (-1 << 1000)).

the following functions were identified as relevant only while working on
#15988, so there are probably (a lot?) more relevant functions.

functions where OverflowError is raised only for big negative ints:
- Objects/bytesobject.c - bytes_new
- Objects/bytearrayobject.c - bytearray_init
- functions that would be fixed as part of #29819?
* Modules/_io/stringio.c - _io_StringIO_truncate_impl
* Modules/_io/bytesio.c - _io_BytesIO_truncate_impl

functions where OverflowError is raised for any negative int (so a change would
probably break some users code):
- Objects/longobject.c:
* PyLong_AsUnsignedLong
* PyLong_AsSize_t
- Modules/_ctypes/_ctypes.c - PyCArrayType_new


Note: while patching these functions, one should also make sure that the
patched functions produce consistent error messages, as explained in #15988
(in which it was decided to leave these functions (which currently produce
inconsistent error messages) to this issue.)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29816] Get rid of C limitation for shift count in right shift

2017-03-15 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +557

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29104] Left bracket remains in format string result when '\' preceeds it

2017-03-15 Thread Jim Fasarakis-Hilliard

Jim Fasarakis-Hilliard added the comment:

A PR has been submitted, Ryan. See https://github.com/python/cpython/pull/490

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29104] Left bracket remains in format string result when '\' preceeds it

2017-03-15 Thread Ryan Gonzalez

Ryan Gonzalez added the comment:

Serhiy: if you want, you can give me your email and I'll submit a PR for you. 
If you want to do it yourself, just:

Download hub: https://hub.github.com/

git clone python/cpython cpython-git
cd cpython-git
git fork
curl 
https://raw.githubusercontent.com/mozilla/moz-git-tools/master/hg-patch-to-git-patch
 > hg-patch-to-git-patch
curl https://bugs.python.org/file46127/fstring_backslash_2.patch | python2 
hg-patch-to-git-patch > fstring.patch
git checkout -b fstring-fix
git apply fstring.patch
git commit -am 'bpo-29104: Commit message here'
git push -u MY_GITHUB_USERNAME fstring-fix
git pull-request

--
nosy: +refi64

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29805] Pathlib.replace cannot move file to a different drive on Windows if filename different

2017-03-15 Thread Brett Cannon

Brett Cannon added the comment:

I should also mention that rename() 
(https://docs.python.org/3/library/pathlib.html#pathlib.Path.rename) and 
replace() (https://docs.python.org/3/library/pathlib.html#pathlib.Path.replace) 
already do exist, so it might be best to add a keyword-only flag to one of 
those for this use-case.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29805] Pathlib.replace cannot move file to a different drive on Windows if filename different

2017-03-15 Thread Brett Cannon

Brett Cannon added the comment:

I also support the idea of getting something like shutil.move() into pathlib.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29822] inspect.isabstract does not work on abstract base classes during __init_subclass__

2017-03-15 Thread Nate Soares

Changes by Nate Soares :


--
pull_requests: +556

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18716] Deprecate the formatter module

2017-03-15 Thread Brett Cannon

Brett Cannon added the comment:

Yes, the code won't be deleted until we're in a post-2.7 world.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24119] Carry comments with the AST

2017-03-15 Thread Brett Cannon

Brett Cannon added the comment:

The type annotation is already in the AST so there's nothing to carry over from 
typed_ast (we only care about the latest Python version while typed_ast tries 
to be version-agnostic).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15988] Inconsistency in overflow error messages of integer argument

2017-03-15 Thread Oren Milman

Oren Milman added the comment:

now that you opened #29816 and #29819, should I remove from the PR changes in 
the following functions, and related tests?
- _io_BytesIO_truncate_impl
- _io_StringIO_truncate_impl
- long_rshift
- long_lshift

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25478] Consider adding a normalize() method to collections.Counter()

2017-03-15 Thread Steven D'Aprano

Steven D'Aprano added the comment:

It seems to me that the basic Counter class should be left as-is, and if there 
are specialized methods used for statistics (such as normalize) it should go 
into a subclass in the statistics module.

The statistics module already uses Counter internally to calculate the mode.

It makes some sense to me for statistics to have a FrequencyTable (and 
CumulativeFrequencyTable?) class built on top of Counter. I don't think it 
makes sense to overload the collections.Counter type with these sorts of 
specialised methods.

--
nosy: +steven.daprano

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29822] inspect.isabstract does not work on abstract base classes during __init_subclass__

2017-03-15 Thread Nate Soares

New submission from Nate Soares:

Here's an example test that fails:

def test_isabstract_during_init_subclass(self):
from abc import ABCMeta, abstractmethod

isabstract_checks = []

class AbstractChecker(metaclass=ABCMeta):
def __init_subclass__(cls):
abstract_checks.append(inspect.isabstract(cls))

class AbstractClassExample(AbstractChecker):

@abstractmethod
def foo(self):
pass

class ClassExample(AbstractClassExample):
def foo(self):
pass

self.assertEqual(isabstract_checks, [True, False])

To run the test, you'll need to be on a version of python where bpo-29581 is 
fixed (e.g., a cpython branch with https://github.com/python/cpython/pull/527 
merged) in order for __init_subclass__ to work with ABCMeta at all in the first 
place. I have a simple patch to inspect.isabstract that fixes this, and will 
make a PR shortly.

--
messages: 289682
nosy: So8res
priority: normal
severity: normal
status: open
title: inspect.isabstract does not work on abstract base classes during 
__init_subclass__
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29821] importing module shutil executes file 'copy.py'

2017-03-15 Thread Oliver Etchebarne (drmad)

New submission from Oliver Etchebarne (drmad):

I didn't research this issue further. Create a file 'test.py', and write only 
'import shutil'. Then create a file 'copy.py' in the same directory, and write 
something inside, like 'print ("OH NO")'.

When you run test.py, 'copy.py' is executed, and prints the string. Tested with 
python 3.5 and 3.6. Works as expected (test.py doing nothing) in python 2.7

--
messages: 289681
nosy: Oliver Etchebarne (drmad)
priority: normal
severity: normal
status: open
title: importing module shutil executes file 'copy.py'
type: behavior
versions: Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29820] Broken link to "GUI Programming with Python: QT Edition" book

2017-03-15 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

Maybe instead of referencing to the books, we add reference to the wiki
https://wiki.python.org/moin/PyQt

--
nosy: +Mariatta
versions:  -Python 3.3, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15988] Inconsistency in overflow error messages of integer argument

2017-03-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think that raising OverflowError exceptions should be avoided if this is 
possible. If some function requires non-negative integer and raises ValueError 
for small negative integers and OverflowError for large negative integers, it 
is desirable to make it raising ValueError for all negative integers. If some 
function truncates integer arguments to specified limit it shouldn't raise 
OverflowError for large positive integers, but truncate them to that limit.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29820] Broken link to "GUI Programming with Python: QT Edition" book

2017-03-15 Thread Marco Buttu

New submission from Marco Buttu:

In [*] the link to "GUI Programming with Python: QT Edition by Boudewijn 
Rempt", does not work.  I did not find an official web page for this book, but 
it is really outdated (2002), so maybe we can take only the reference to the 
Mark Summerfield's book, about PyQt4.  Let me know, so in case I will open a PR.


[*] https://docs.python.org/3/library/othergui.html

--
assignee: docs@python
components: Documentation
messages: 289678
nosy: docs@python, marco.buttu
priority: normal
severity: normal
status: open
title: Broken link to "GUI Programming with Python: QT Edition" book
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29819] Avoid raising OverflowError in truncate() if possible

2017-03-15 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29819] Avoid raising OverflowError in truncate() if possible

2017-03-15 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +Oren Milman

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29819] Avoid raising OverflowError in truncate() if possible

2017-03-15 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

os.truncate(), os.ftruncate() and truncate() methods of file-like objects raise 
OverflowError when the argument is out of ranger of certain C type. It would be 
better to extend the behavior of small integers to large integers. ValueError 
is raised for negative integers and it should be raised for negative integers 
out of range. Values larger than the current size should be ignored in 
BytesIO.truncate() and StringIO.truncate(). BytesIO.truncate() and 
StringIO.truncate() should never raise OverflowError. Since the behavior of 
underlying OS functions is OS and FS depended, OverflowError can be raised for 
large integers in os.truncate(), os.ftruncate() and FileIO.truncate().

--
components: IO, Library (Lib)
messages: 289677
nosy: benjamin.peterson, serhiy.storchaka, stutzbach
priority: normal
severity: normal
stage: needs patch
status: open
title: Avoid raising OverflowError in truncate() if possible
type: enhancement
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29817] File IO r+ read, write, read causes garbage data write.

2017-03-15 Thread Paul Moore

Changes by Paul Moore :


--
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29817] File IO r+ read, write, read causes garbage data write.

2017-03-15 Thread Paul Moore

Paul Moore added the comment:

Also, this is a Python 2 only issue. The problem doesn't happen in Python 3.6 
(at least in my quick experiment). I'm not 100% sure if this is because the 
internal implementation of IO changed in 3.x, or if it's just because we're now 
using a newer CRT which has fixed the issue.

I agree that there's no point in Python trying to work around this behaviour.

--
resolution:  -> third party

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29817] File IO r+ read, write, read causes garbage data write.

2017-03-15 Thread Eryk Sun

Eryk Sun added the comment:

This is a bug in the C runtime's handling of "r+" mode with buffering. 

The CRT FILE stream's internal _cnt field, from the POV of the write() call, is 
the number of bytes that can be written to the internal buffer before it's 
full. The default buffer size is 4096 bytes. Thus after writing "Some Data", 
_cnt is at 4096 - 9 == 4087 bytes. 

On the other hand, from the POV of the subsequent read() call, this means there 
are 4087 bytes in the buffer available to be read. If you change your code to 
keep the result, you'll see that it is indeed 4087 bytes. 

After the read, _cnt is at 0 and the stream's internal _ptr and _base pointers 
indicate a full buffer, which gets flushed to disk when the file is closed. If 
you change your code to print os.path.getsize(testPath) after the file is 
closed, then you should see that the size is 4096 bytes -- exactly one buffer. 

If you open the file with buffering=512, then this changes to 503 bytes read 
and creates a 512 byte file.

Can and should Python do anything to work around this problem in the CRT? Or 
should this issue simply be closed as 3rd party? I'm inclined to close it.

--
nosy: +eryksun

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29804] test_ctypes test_pass_by_value fails on arm64 (aarch64) architecture

2017-03-15 Thread Vinay Sajip

Changes by Vinay Sajip :


--
nosy: +ned.deily

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29804] test_ctypes test_pass_by_value fails on arm64 (aarch64) architecture

2017-03-15 Thread Vinay Sajip

Vinay Sajip added the comment:

I don't think it's a regression. It's catching an error that was there, but 
wasn't tested for before.

If it should be a release blocker - that should not be for any reversion of the 
change to the test, but for implementing the pass-by-value functionality 
correctly.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28261] wrong error messages when using PyArg_ParseTuple to parse normal tuples

2017-03-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I suggest to withdraw changes in itertoolsmodule.c and avoid using "dunder" 
names like __setstate__ and __new__ in error messages.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28261] wrong error messages when using PyArg_ParseTuple to parse normal tuples

2017-03-15 Thread Oren Milman

Oren Milman added the comment:

Raymond? any suggestions for how to make the code less ugly?
or do you have in mind a different approach for solving this issue?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28230] tarfile does not support pathlib

2017-03-15 Thread Berker Peksag

Berker Peksag added the comment:

PR 512 has been merged and backported to 3.6 branch. I think this can be closed 
now. Thanks, Ethan and Serhiy!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29804] test_ctypes test_pass_by_value fails on arm64 (aarch64) architecture

2017-03-15 Thread Charalampos Stratakis

Charalampos Stratakis added the comment:

Since this newly added assertion [0] fails for aarch64 shouldn't this be 
considered a regression?

And taking into account the timeframe, a release blocker for 3.6.1?

--
nosy: +cstratak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29804] test_ctypes test_pass_by_value fails on arm64 (aarch64) architecture

2017-03-15 Thread Charalampos Stratakis

Charalampos Stratakis added the comment:

[0] 
https://github.com/python/cpython/commit/a86339b83fbd0932e0529a3c91935e997a234582#diff-39e8978a35ab16f78e60027c61b810f7R413

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29818] Py_SetStandardStreamEncoding leads to a memory error in debug mode

2017-03-15 Thread Nick Coghlan

Changes by Nick Coghlan :


--
versions: +Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29818] Py_SetStandardStreamEncoding leads to a memory error in debug mode

2017-03-15 Thread Nick Coghlan

New submission from Nick Coghlan:

For PEP 538, setting PYTHONIOENCODING turned out to have undesirable side 
effects on Python 2 instances in subprocesses, since Python 2 has no 
'surrogateescape' error handler.

So I switched to using the "Py_SetStandardStreamEncoding" API defined in 
http://bugs.python.org/issue16129 instead, but this turns out to have 
problematic interactions with the dynamic memory allocator management, so it 
fails with a fatal exception in debug mode. An example of the error can be seen 
here: https://travis-ci.org/python/cpython/jobs/211293576

The problem appears to be that between the allocation of the memory with 
`_PyMem_RawStrdup` in `Py_SetStandardStreamEncoding` and the release of that 
memory in `initstdio`, the active memory manager has changed (at least in a 
debug build), so the deallocation as part of the interpreter startup fails.

That interpretation is based on this comment in Programs/python.c:

```
/* Force again malloc() allocator to release memory blocks allocated
   before Py_Main() */
(void)_PyMem_SetupAllocators("malloc");
```

The allocations in Py_SetStandardStreamEncoding happen before the call to 
Py_Main/Py_Initialize, but the deallocation happens in Py_Initialize.

The "fix" I applied to the PEP branch was to make the default allocator 
conditional in Programs/python.c as well:

```
#ifdef Py_DEBUG
(void)_PyMem_SetupAllocators("malloc_debug");
#  else
(void)_PyMem_SetupAllocators("malloc");
#  endif
```

While that works (at least in the absence of a PYTHONMALLOC setting) it seems 
fragile. It would be nicer if there was a way for Py_SetStandardStreamEncoding 
to indicate which allocator should be used for the deallocation.

--
messages: 289668
nosy: haypo, ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Py_SetStandardStreamEncoding leads to a memory error in debug mode
type: crash

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29726] test_xmlrpc raises DeprecationWarnings

2017-03-15 Thread Berker Peksag

Berker Peksag added the comment:

Thanks, Dillon! I went ahead and backported PR 481 to 3.5 and 3.6 branches.

--
nosy: +berker.peksag
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29196] Remove old-deprecated plistlib features

2017-03-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

These classes was deprecated in 2.4. In 2.6 the plistlib module was moved from 
plat-mac to the general stdlib library.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29655] Certain errors during IMPORT_STAR can leak a reference

2017-03-15 Thread Berker Peksag

Changes by Berker Peksag :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29815] Fail at divide a negative integer number for a positive integer number

2017-03-15 Thread Eryk Sun

Eryk Sun added the comment:

> -7 divided by 2 is -3, not -4

Integer division in Python is floor division, and it's self-consistent with the 
implementation of the modulo operation such that the following identity is 
satisfied: (a % n) == a - n * (a // n). For example: 

(-7 % 2) == -7 - 2 * (-7 // 2)
   1 == -7 - 2 * (-4)
 == -7 + 8

This behavior is consistent with mathematical analysis languages such as 
MATLAB, Mathematica, Mathcad, and R. It's also consistent with Ruby, Perl, and 
Tcl. However, it's different from C, C++, C#, Java, PHP and many other 
languages. See the following Wikipedia article:

https://en.wikipedia.org/wiki/Modulo_operation

Please do not change the status and resolution of this issue again. This is not 
a bug.

--
nosy: +eryksun
resolution: rejected -> not a bug
status: open -> closed
type: crash -> behavior
versions:  -Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19264] subprocess.Popen doesn't support unicode on Windows

2017-03-15 Thread Valentin LAB

Valentin LAB added the comment:

For eventual other people wanting a workaround, this is the code I used to 
leverage ``ctypes`` and redo what last python 3 code is doing. Any comment are 
welcome, this is my first go at ``ctypes``. I didn't extensively tested the 
code... so use at your own risk. The Gist might evolve if some people find 
issues:

https://gist.github.com/vaab/2ad7051fc193167f15f85ef573e54eb9

Tests/Usecases are simple: use ``subprocess.Popen(..)`` to simply issue a ``git 
commit -am "ć"``. And display the changelog. You can also call another python 
script, that would then need this other recipe (this time to get ``sys.argv`` 
correctly encoded on windows):

http://code.activestate.com/recipes/572200/

Hope that helps.

--
nosy: +Valentin LAB

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4851] xml.dom.minidom.Element.cloneNode fails with AttributeError

2017-03-15 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for your detective work, Craig. MvL is correct that those classes should 
be created via a Document object. I'm marking issue 15290 as a duplicate of 
this.

Note that we can reopen this if you'd like to propose a documentation patch or 
PR to make the current docs clearer. Thanks!

--
nosy: +berker.peksag
resolution:  -> not a bug
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15290] setAttribute() can fail

2017-03-15 Thread Berker Peksag

Changes by Berker Peksag :


--
resolution: not a bug -> duplicate
stage: patch review -> resolved
superseder:  -> xml.dom.minidom.Element.cloneNode fails with AttributeError

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29816] Get rid of C limitation for shift count in right shift

2017-03-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is not MemoryError. On 32-bit platform `1 << (sys.maxsize + 1)` raises an 
OverflowError, but `1 << sys.maxsize << 1` can be calculated.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18716] Deprecate the formatter module

2017-03-15 Thread Jim Fasarakis-Hilliard

Jim Fasarakis-Hilliard added the comment:

Just bumped into this. 

Is the removal for this module waiting for the end of Python 2.7 support as PEP 
4 states for modules in Py2 and Py3? 

The first message calls for a removal in 3.6 so, I'm either missing some 
additional conversations on this or this might of just have been forgotten.

--
nosy: +Jim Fasarakis-Hilliard

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29816] Get rid of C limitation for shift count in right shift

2017-03-15 Thread STINNER Victor

STINNER Victor added the comment:

> I think an OverflowError is appropriate here for denoting the platform and 
> implementation limitation.

It's common that integer overflow on memory allocation in C code raises a 
MemoryError, not an OverflowError.

>>> "x" * (2**60)
Traceback (most recent call last):
  File "", line 1, in 
MemoryError

I suggest to raise a MemoryError.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29815] Fail at divide a negative integer number for a positive integer number

2017-03-15 Thread Marcos Thomaz

Marcos Thomaz added the comment:

Note that mathematic expression is wrong. -7 divided by 2 is -3, not -4

--
resolution:  -> rejected
type: behavior -> crash

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29725] sqlite3.Cursor doesn't properly document "arraysize"

2017-03-15 Thread Berker Peksag

Changes by Berker Peksag :


--
keywords: +easy
nosy: +berker.peksag
stage:  -> needs patch
type:  -> enhancement
versions: +Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29816] Get rid of C limitation for shift count in right shift

2017-03-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This may be a part of this issue or a separate issue: bytes(-1) raises a 
ValueError, but bytes(-10**100) raises an OverflowError.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29812] test for token.py, and consistency tests for tokenize.py

2017-03-15 Thread Jim Fasarakis-Hilliard

Changes by Jim Fasarakis-Hilliard :


--
nosy: +Jim Fasarakis-Hilliard

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29817] File IO r+ read, write, read causes garbage data write.

2017-03-15 Thread Jan

Changes by Jan :


--
title: File IO read, write, read causes garbage data write. -> File IO r+ read, 
write, read causes garbage data write.

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29817] File IO read, write, read causes garbage data write.

2017-03-15 Thread Jan

New submission from Jan:

In Python 2.7.12 when reading, writing and subsequently reading again from a 
file, python seems to write garbage.

For example when running this in python IDLE: 

import os 
testPath = r"myTestFile.txt"

## Make sure the file exists and its empty
with open(testPath,"w") as tFile:
tFile.write("")

print "Our Test File: ", os.path.abspath(testPath )

with open(testPath, "r+") as tFile:
## First we read the file 
data = tFile.read()

## Now we write some data 
tFile.write('Some Data')

## Now we read the file again
tFile.read()


When now looking at the file the data is the following:

Some Data @ sb d Z d d l m Z d d d ・ ・ YZ e d k r^ d d l m Z e d d d d e ・n d 
S( s9
Implement Idle Shell history mechanism with History
... 

As mentioned in the comments on stack overflow ( see link ) this might be a 
buffer overrun but I am not sure. Also I guess this could be used as a security 
vulnerability... 

http://stackoverflow.com/questions/40373457/python-r-read-write-read-writes-garbage-to-a-file?noredirect=1#comment72580538_40373457

--
components: IO, Interpreter Core, Windows
messages: 289657
nosy: jan, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: File IO read, write, read causes garbage data write.
type: behavior
versions: Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29815] Fail at divide a negative integer number for a positive integer number

2017-03-15 Thread Marcos Thomaz

Marcos Thomaz added the comment:

Try this operations, in interactive environment:

>> 7 // 2
3
>> -7 // 2
-4

--
resolution: not a bug -> 
status: closed -> open
versions: +Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29815] Fail at divide a negative integer number for a positive integer number

2017-03-15 Thread Marcos Thomaz

Marcos Thomaz added the comment:

I'm sorry, but was a typing error. Try this operations:

a, b, c = 7, -7, 2
print "1:", a // c, a % c
print "2:", b // c, b % c

the result is:
1: 3 1
2: -4 1

The division is the same, except by the signal (variable b is negative, but 
both, variables "a" and "b" are integers).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29816] Get rid of C limitation for shift count in right shift

2017-03-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> If we change something, I suggest to be consistent with lshift. I expect a 
> memory error on "1 << (1 << 1024)" (no unlimited loop before a global system 
> collapse please ;-))

I agree that left shift should raise an ValueError rather than OverflowError 
for large negative shifts. But is hard to handle large positive shifts. `1 << 
count` consumes `count*2/15` bytes of memory. There is a gap between the 
maximal value of bits represented as Py_ssize_t (PY_SSIZE_T_MAX) and the number 
of bits of maximal Python int (PY_SSIZE_T_MAX*15/2). _PyLong_NumBits() starves 
from the same issue. I think an OverflowError is appropriate here for denoting 
the platform and implementation limitation.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15988] Inconsistency in overflow error messages of integer argument

2017-03-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I just have started reviewing the PR and it looks great!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15988] Inconsistency in overflow error messages of integer argument

2017-03-15 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
dependencies: +Get rid of C limitation for shift count in right shift, can't 
set big int-like objects to items in array 'Q', 'L' and 'I'

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29816] Get rid of C limitation for shift count in right shift

2017-03-15 Thread STINNER Victor

STINNER Victor added the comment:

FYI I saw recently that the C limitation of len() was reported in the 
"owasp-pysec" project:
https://github.com/ebranca/owasp-pysec/wiki/Overflow-in-len-function

I don't understand what such "deliberate" limitation was reported in a hardened 
CPython project?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29816] Get rid of C limitation for shift count in right shift

2017-03-15 Thread STINNER Victor

STINNER Victor added the comment:

If we change something, I suggest to be consistent with lshift. I expect a 
memory error on "1 << (1 << 1024)" (no unlimited loop before a global system 
collapse please ;-))

--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29816] Get rid of C limitation for shift count in right shift

2017-03-15 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Currently the value of right operand of the right shift operator is limited by 
C Py_ssize_t type.

>>> 1 >> 10**100
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: Python int too large to convert to C ssize_t
>>> (-1) >> 10**100
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: Python int too large to convert to C ssize_t
>>> 1 >> -10**100
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: Python int too large to convert to C ssize_t
>>> (-1) >> -10**100
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: Python int too large to convert to C ssize_t

But this is artificial limitation. Right shift can be extended to support 
arbitrary integers. `x >> very_large_value` should be 0 for non-negative x and 
-1 for negative x. `x >> negative_value` should raise ValueError.

>>> 1 >> 10
0
>>> (-1) >> 10
-1
>>> 1 >> -10
Traceback (most recent call last):
  File "", line 1, in 
ValueError: negative shift count
>>> (-1) >> -10
Traceback (most recent call last):
  File "", line 1, in 
ValueError: negative shift count

--
components: Interpreter Core
messages: 289650
nosy: Oren Milman, mark.dickinson, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: Get rid of C limitation for shift count in right shift
type: enhancement
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28647] python --help: -u is misdocumented as binary mode

2017-03-15 Thread Nick Coghlan

Nick Coghlan added the comment:

I just ran into this discrepancy working on the test cases for PEP 538 - +1 for 
Gareth's suggested approach of just aligning the `--help` output with the man 
page.

--
nosy: +ncoghlan

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29815] Fail at divide a negative integer number for a positive integer number

2017-03-15 Thread Martin Panter

Martin Panter added the comment:

If you ignore the c[0] argument, the rest looks fine to me. See the 
documentation at 

 and 
.

The double-slash operator is called “floor division”. If you are expecting some 
other rounding, see 
.

--
nosy: +martin.panter
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
type: crash -> behavior
versions:  -Python 3.3, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29815] Fail at divide a negative integer number for a positive integer number

2017-03-15 Thread Marcos Thomaz

New submission from Marcos Thomaz:

At divide a negative integer number for a positive integer number, the result 
is wrong. For example, in operation:

a, b, c = -7, 2, 7
d = divmod(a, b)
print a//b, a%b, c[0], c // b, c%b

The values printed are -4  1 3 1

--
components: Interpreter Core
messages: 289647
nosy: marcosthomazs
priority: normal
severity: normal
status: open
title: Fail at divide a negative integer number for a positive integer number
type: crash
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29800] functools.partial segfaults in repr when keywords attribute is abused

2017-03-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your contribution Michael!

--
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29104] Left bracket remains in format string result when '\' preceeds it

2017-03-15 Thread Eric V. Smith

Eric V. Smith added the comment:

Serhiy: I plan to find time in the next week or so to look at this. Sorry for 
the delay. Plus, the new workflow isn't helping me out: I need to get up to 
speed on it.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29800] functools.partial segfaults in repr when keywords attribute is abused

2017-03-15 Thread Michael Seifert

Changes by Michael Seifert :


--
pull_requests: +555

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29814] parsing f-strings -- opening brace of expression gets duplicated when preceeded by backslash

2017-03-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is a duplicate of issue29104.

--
nosy: +serhiy.storchaka
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Left bracket remains in format string result when '\' preceeds 
it

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29800] functools.partial segfaults in repr when keywords attribute is abused

2017-03-15 Thread Michael Seifert

Changes by Michael Seifert :


--
pull_requests: +554

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29715] Argparse improperly handles "-_"

2017-03-15 Thread Mateusz Bysiek

Changes by Mateusz Bysiek :


--
title: Arparse improperly handles "-_" -> Argparse improperly handles "-_"

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28964] AST literal_eval exceptions provide no information about line number

2017-03-15 Thread Mateusz Bysiek

Changes by Mateusz Bysiek :


--
nosy: +mbdevpl

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10399] AST Optimization: inlining of function calls

2017-03-15 Thread Mateusz Bysiek

Changes by Mateusz Bysiek :


--
nosy: +mbdevpl

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11549] Build-out an AST optimizer, moving some functionality out of the peephole optimizer

2017-03-15 Thread Mateusz Bysiek

Changes by Mateusz Bysiek :


--
nosy: +mbdevpl

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29471] AST: add an attribute to FunctionDef to distinguish functions from generators and coroutines

2017-03-15 Thread Mateusz Bysiek

Changes by Mateusz Bysiek :


--
nosy: +mbdevpl

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24119] Carry comments with the AST

2017-03-15 Thread Mateusz Bysiek

Mateusz Bysiek added the comment:

For some time now, there's an alternate ast implementation 
https://github.com/python/typed_ast that carries PEP 484 type comments with the 
AST as attributes of certain nodes.

Their approach is described here: 
https://github.com/python/typed_ast/blob/master/typed_ast/ast3.py#L5

If type comments become mainstream in Python, could this approach maybe be 
adopted as official Python AST at some point?

--
nosy: +mbdevpl

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29051] Improve error reporting involving f-strings (PEP 498)

2017-03-15 Thread Mateusz Bysiek

Changes by Mateusz Bysiek :


--
nosy: +mbdevpl

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29814] parsing f-strings -- opening brace of expression gets duplicated when preceeded by backslash

2017-03-15 Thread Mateusz Bysiek

New submission from Mateusz Bysiek:

with Python 3.6.0 and the following script:

```
#!/usr/bin/env python3.6

import ast

code1 = '''"\\{x}"'''
code2 = '''f"\\{x}"'''

tree1 = ast.parse(code1, mode='eval')
print(ast.dump(tree1))
tree2 = ast.parse(code2, mode='eval')
print(ast.dump(tree2))
```

I get the following output:

```
Expression(body=Str(s='\\{x}'))
Expression(body=JoinedStr(values=[Str(s='\\{'), 
FormattedValue(value=Name(id='x', ctx=Load()), conversion=-1, 
format_spec=None)]))
```

Therefore, the normal string is `'\\{x}'`.
But the f-string has two parts: `'\\{'` and an expression `Name(id='x', 
ctx=Load())`.

Where does the `{` in the string part of f-string come from? I can't believe 
this is the intended behavior... Or, is it?

When I escape the backslash once like above, what gets parsed is actually 
unescaped backslash. So this might just boil down to inconsistency in parsing 
`\{` in normal vs. f-strings.

I originally discovered this in typed_ast 
https://github.com/python/typed_ast/issues/34 but the behaviour of ast is 
identical and since developers of typed_ast aim at compatibility with ast, I 
bring this issue here.

--
components: Library (Lib)
messages: 289642
nosy: mbdevpl
priority: normal
severity: normal
status: open
title: parsing f-strings -- opening brace of expression gets duplicated when 
preceeded by backslash
type: behavior
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29800] functools.partial segfaults in repr when keywords attribute is abused

2017-03-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Could you create PRs for 3.6 and 3.5 Michael?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com