[issue29114] __class__ not exists in the method which bounded by types.MethodType.

2016-12-29 Thread Xiang Zhang

Xiang Zhang added the comment:

You can't do it like this. The document explicitly states it only works inside 
a class definition:

"Also note that, aside from the zero argument form, super() is not limited to 
use inside methods. The two argument form specifies the arguments exactly and 
makes the appropriate references. The zero argument form only works inside a 
class definition, as the compiler fills in the necessary details to correctly 
retrieve the class being defined, as well as accessing the current instance for 
ordinary methods."

So if treat it as an enhancement, is it reasonable Nick?

--
nosy: +ncoghlan, xiang.zhang

___
Python tracker 

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



[issue29108] Python 3.6.0 multiprocessing map_async callback

2016-12-29 Thread Jose Miguel Colella

Jose Miguel Colella added the comment:

Hello David,
Thanks for your response. Improvements to the documentation could clear this 
misunderstanding. I had initially believed that after transforming with the 
function passed to the map, it would use the callback on each of the result 
arguments. 
Just to understand the use case of the callback. So basically it should not 
return anything and be a simple print?

--

___
Python tracker 

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



[issue29103] Make enum.py pep8 compliant

2016-12-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset bf6987b93358 by Raymond Hettinger in branch '3.6':
Issue #29103: Remove unused import.  Noticed by Jean-Sebastien Bevilacqua.
https://hg.python.org/cpython/rev/bf6987b93358

--
nosy: +python-dev

___
Python tracker 

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



[issue29099] sqlite3 timestamp converter cannot handle timezone

2016-12-29 Thread Xiang Zhang

Xiang Zhang added the comment:

LGTM generally. :-)

--

___
Python tracker 

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



[issue29103] Make enum.py pep8 compliant

2016-12-29 Thread Jean-Sebastien Bevilacqua

Jean-Sebastien Bevilacqua added the comment:

Hello Raymond Hettinger,
Thanks for your advice and your comment.

I agree with you that pep8 compliant isn't useful. If you look at my patch, the 
first change is a unused import, not just a text formatting.

Maybe this first change can be useful ? (not importing unused module)

--

___
Python tracker 

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



[issue29110] [patch] Fix file object leak in `aifc.open` when given invalid AIFF file.

2016-12-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
nosy: +serhiy.storchaka
stage:  -> patch review
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



[issue28612] str.translate needs a mapping example

2016-12-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

If the side effect of defaultdict is unpleasant, the correct way is combining 
the translation mapping with the custom mapping by ChainMap. But this example 
is too complex for the documentation of str.translate(). On other side, it is 
trivial for more experience users and don't need special mentioning.

I think other resources (ActiveState Code Reciepes [1] or books) are better 
places for this example.

[1] http://code.activestate.com/recipes/popular/

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue29061] secrets.randbelow(-1) hangs

2016-12-29 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Thanks for the bug report and for the patch.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue29061] secrets.randbelow(-1) hangs

2016-12-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0509844f38df by Raymond Hettinger in branch '3.6':
Issue #29061:  secrets.randbelow() would hang with a negative input
https://hg.python.org/cpython/rev/0509844f38df

--
nosy: +python-dev

___
Python tracker 

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



[issue29114] __class__ not exists in the method which bounded by types.MethodType.

2016-12-29 Thread lanf0n

New submission from lanf0n:

test code below:

```python

>>> from types import MethodType
>>> class A:
...   def f(self):
... print(__class__)
...
>>> a = A()
>>> a.fn = MethodType(lambda s: print(__class__), a)
>>>
>>> a.f()

>>> a.fn()
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 1, in 
NameError: name '__class__' is not defined
```

this behavior affect `super()` not work in patched function scope, 
of course we can use old super as super(self.__class__, self) to make it work 
as expected, but I think it should work as original method if we already 
bounded the function to instance(class).

--
components: Library (Lib)
messages: 284313
nosy: lanfon72
priority: normal
severity: normal
status: open
title: __class__ not exists in the method which bounded by types.MethodType.
type: behavior
versions: Python 3.5, Python 3.6

___
Python tracker 

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



[issue29111] Strange signature for memoryview constructor

2016-12-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
components: +Interpreter Core -Library (Lib)
nosy: +larry, skrah, yselivanov
type:  -> behavior
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



[issue29061] secrets.randbelow(-1) hangs

2016-12-29 Thread Raymond Hettinger

Raymond Hettinger added the comment:

_randbelow is a private api and it is not broken, it is just being misused by 
the secrets module.   All of the other calls to it are already range checked 
and it would be inefficient and unnecessary to repeat this the check.

Brendan, thank you for the updated patch.  It looks correct.  I will apply 
shortly.

Please do follow-up with Ewa so we can get the asterisk to appear by your name 
:-)

--

___
Python tracker 

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



[issue29020] collapse_rfc2231_value has inconsistent unquoting

2016-12-29 Thread Eric Lafontaine

Eric Lafontaine added the comment:

Hi all,

The fix is already provided in issue28945 .  Please review it and I would like 
to flag it as needing more test on more version of python...

The patch would just require more Test Case that would check for the 
filename for preventing re-occurence in the future on the file-name.

Thanks for the analysis bpoaugust :).  I'm hoping no client relied on this 
function for the unquote though...

Regards,
Eric Lafontaine

--

___
Python tracker 

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



[issue29089] dictionary keys described incorrectly in tutorial

2016-12-29 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I'm going to concur with the other respondents on this.  As a Python teacher, 
this is how I teach what should be used as a dictionary key.

While immutability and hashability aren't equivalent, it is a good first 
approximation.  Also, even though it is true that you could make a hashable 
object that is mutable, it is generally a bad practice that leads to regrets.

I'm going to close this.  If someone wants to change the styling of the 
tutorial, that can reasonably be discussed in another patch.

Thank you for your ideas, but we're going to pass on this one.  The tutorial is 
a place where it can be counter-productive to 1) make discussions too long, 2) 
go into atypical practices, 3) add too many caveats in a effort to be overly 
precise, etc.   Also, this part of the tutorial has been around for many years 
and has done a reasonably good job at educating its readers.

--
nosy: +rhettinger
resolution:  -> rejected
status: open -> closed

___
Python tracker 

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



[issue28612] str.translate needs a mapping example

2016-12-29 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I like the idea of adding a mapping example but don't want to encourage use of 
defaultdict in contexts like this one.  A defaultdict usefully specifies a 
default but has the unpleasant side-effect of altering the dictionary (adding 
new keys) during the look-up phase.  This has bitten a lot of people (including 
famous ones like Peter Norvig).

--
nosy: +rhettinger

___
Python tracker 

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



[issue29103] Make enum.py pep8 compliant

2016-12-29 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I really don't like how this patch is done or even the spirit of it.  To my 
eyes, some of the code looks worse (especially the addition of trailing 
backslashes and some odd line-wraps that aren't sensitive to readability or 
context).

I'm going to close this.   If Ethan wants to make minor tweaks to his 
whitespace or line-wrapping, I believe he can do a better job with his own code.

Jean-Sebastien, thank you for trying to contribute, but PEP-8ing other people's 
code generally isn't helpful.  I recommend that you find a tracker item that 
needs a patch for a substantive change and work on that.  I think you will find 
it more satisfying and will have a much greater chance of acceptance.

--
nosy: +rhettinger
resolution:  -> rejected
status: open -> closed

___
Python tracker 

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



[issue29112] questionable wording in sequences documentation

2016-12-29 Thread Xiang Zhang

Xiang Zhang added the comment:

Thanks for your report Jesse. Now fixed.

--
nosy: +xiang.zhang
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
versions: +Python 2.7, Python 3.5, Python 3.7

___
Python tracker 

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



[issue29112] questionable wording in sequences documentation

2016-12-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0d20da97a6a0 by Xiang Zhang in branch '2.7':
Issue #29112: Fix a questionable wording in sequence doc.
https://hg.python.org/cpython/rev/0d20da97a6a0

New changeset f4b747f59804 by Xiang Zhang in branch '3.5':
Issue #29112: Fix a questionable wording in sequence doc.
https://hg.python.org/cpython/rev/f4b747f59804

New changeset b09d0a2587da by Xiang Zhang in branch '3.6':
Issue #29112: Merge 3.5.
https://hg.python.org/cpython/rev/b09d0a2587da

New changeset 4432cba89398 by Xiang Zhang in branch 'default':
Issue #29112: Merge 3.6.
https://hg.python.org/cpython/rev/4432cba89398

--
nosy: +python-dev

___
Python tracker 

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



[issue29113] modulefinder no longer finds all required modules for Python itself, due to use of __import__ in sysconfig

2016-12-29 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +doko
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



[issue29108] Python 3.6.0 multiprocessing map_async callback

2016-12-29 Thread Davin Potts

Davin Potts added the comment:

This appears to be working as designed.  The purpose of the callback is to 
receive a single argument (nominally, the ready result from the map operation) 
and perform its task (whatever it may be) very quickly so as not to further 
delay the handing back of results from the map operation.

Attempting to read into your comments, it sounds like you were perhaps 
expecting the return from the callback to appear somewhere?  If that was your 
expectation then no, that is not the purpose of a callback here.  Any 
transformation of input data to the final output data is performed by the 
function being applied by the map.  While there are many potential uses for a 
callback, its stated requirement is that it be as quick an operation as 
possible as opposed to something that further transforms the results or 
anything like a "reduce" operation which is not necessarily quick.

If you think this needs clarification in the documentation, please suggest 
something?

--

___
Python tracker 

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



[issue29113] modulefinder no longer finds all required modules for Python itself, due to use of __import__ in sysconfig

2016-12-29 Thread Adam Williamson

New submission from Adam Williamson:

I'm not sure if this is really considered a bug or just an unavoidable 
limitation, but as it involves part of the stdlib operating on Python itself, I 
figured it was at least worth reporting.

In Fedora we have a fairly simple little script called python-deps:

https://github.com/rhinstaller/anaconda/blob/master/dracut/python-deps

which is used to figure out the dependencies of a couple of Python scripts used 
in the installer's initramfs environment, so the necessary bits of Python (but 
not the rest of it) can be included in the installer's initramfs.

Unfortunately, with Python 3.6, this seems to be broken for the core of Python 
itself, because of this change:

https://github.com/python/cpython/commit/a6431f2c8cf4783c2fd522b2f6ee04c3c204237f

which changed sysconfig.py from doing "from _sysconfigdata import 
build_time_vars" to using __import__ . I *think* that modulefinder can't cope 
with this use of __import__ and so misses that sysconfig requires 
"_sysconfigdata_m_linux_x86_64-linux-gnu" (or whatever the actual name is on 
your particular platform and arch).

This results in us not including the platform-specific module in the installer 
initramfs, so Python blows up on startup when the 'site' module tries to import 
the 'sysconfig' module.

We could work around this one way or another in the python-deps script, but I 
figured the issue was at least worth an upstream report to see if it's 
considered a significant issue or not.

You can reproduce the problem quite trivially by writing a test script which 
just does, e.g., "import site", and then running the example code from the 
ModuleFinder docs on it:

from modulefinder import ModuleFinder

finder = ModuleFinder()
finder.run_script('test.py')

print('Loaded modules:')
for name, mod in finder.modules.items():
print('%s: ' % name, end='')
print(','.join(list(mod.globalnames.keys())[:3]))

if you examine the output, you'll see that the 'sysconfig' module is included, 
but the site-specific module is not.

--
components: Library (Lib)
messages: 284304
nosy: adamwill
priority: normal
severity: normal
status: open
title: modulefinder no longer finds all required modules for Python itself, due 
to use of __import__ in sysconfig
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



[issue29112] questionable wording in sequences documentation

2016-12-29 Thread Jesse Hall

New submission from Jesse Hall:

In note 3 of 4.6.1, the word "string" should be replaced with "sequence", 
because the note is describing a general example where this concept is not 
specifically used with a string type sequence, it is discussing the general use 
of negative indexes which can be used on any type of sequence.

--
assignee: docs@python
components: Documentation
messages: 284303
nosy: Jesse Hall, docs@python
priority: normal
severity: normal
status: open
title: questionable wording in sequences documentation
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



[issue29111] Strange signature for memoryview constructor

2016-12-29 Thread Antony Lee

New submission from Antony Lee:

The return value of `inspect.signature(memoryview)` is rather strange:

Python 3.5.2 (default, Nov  7 2016, 11:31:36) 
[GCC 6.2.1 20160830] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import inspect; inspect.signature(memoryview)


--
components: Library (Lib)
messages: 284302
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: Strange signature for memoryview constructor
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



[issue29020] collapse_rfc2231_value has inconsistent unquoting

2016-12-29 Thread Eric Lafontaine

Changes by Eric Lafontaine :


--
nosy: +Eric Lafontaine

___
Python tracker 

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



[issue29109] Small doc improvements for tracemalloc

2016-12-29 Thread STINNER Victor

STINNER Victor added the comment:

Thank you for your contribution! I applied your patch to Python 3.5, 3.6 and 
default (future 3.7).

You should consider signing the PSF Contributor Agreement:
https://www.python.org/psf/contrib/contrib-form/

"While you retain the copyright, giving the PSF the ability to license your 
code means it can be put under the PSF license so it can be legally distributed 
with Python."

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue29109] Small doc improvements for tracemalloc

2016-12-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 192e0ae17236 by Victor Stinner in branch '3.5':
Issue #29109: Enhance tracemalloc documentation
https://hg.python.org/cpython/rev/192e0ae17236

--
nosy: +python-dev

___
Python tracker 

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



[issue29110] [patch] Fix file object leak in `aifc.open` when given invalid AIFF file.

2016-12-29 Thread Anthony Zhang

Changes by Anthony Zhang :


Added file: 
http://bugs.python.org/file46088/fix_aifc_leak_and_file_object_close.patch

___
Python tracker 

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



[issue29110] [patch] Fix file object leak in `aifc.open` when given invalid AIFF file.

2016-12-29 Thread Anthony Zhang

New submission from Anthony Zhang:

Summary
---

This shows up as two closely-related issues:

* ``aifc.open`` leaks file object when invalid AIFF file encountered. This is 
probably a bug.
* ``aifc.close`` closes file object even when it didn't open the file object to 
begin with. While this is technically documented behaviour [1], it's 
inconsistent with how similar modules like ``wave`` work [2].

I have confirmed the issue is present in all the selected Python versions.

Steps to reproduce
--

For the first issue, run this code:

#!/usr/bin/env python3

# to simplify this example, use this script itself as a random non-AIFF 
file (though any non-AIFF file will work fine)
FILE = __file__

# print warnings on stderr
import warnings
warnings.resetwarnings()

# try to open the non-AIFF file as an AIFF file, which should fail, but 
shouldn't give any ResourceWarnings
import aifc
try: aifc.open(FILE, "rb")
except: pass

For the second issue, run this code:

#!/usr/bin/env python3

from os import path
FILE = path.expanduser("~/cpython/Lib/test/audiodata/pluck-pcm8.aiff")

# open the file as a file-like object, then open it again with ``aifc.open``
import aifc
with open(FILE, "rb") as f:
assert not f.closed, "Before opening with AIFC"
with aifc.open(f, "rb"):
pass
assert not f.closed, "After opening with AIFC"

Expected result
---

For the first code sample, code should give no output - ``aifc.open`` should 
throw an exception due to the passed filename being an invalid AIFF file, but 
that exception should be caught and suppressed. by the ``try``/``except`` 
statements.

For the second code sample, all assertions should pass - the file should be 
opened with ``open``, "opened" again with ``aifc.open``, and should not be 
closed when the inner context manager exits.

Actual result
-

For the first code sample:

$ python3 test.py
/home/anthony/Desktop/test.py:13: ResourceWarning: unclosed file 
<_io.BufferedReader name='/home/anthony/Desktop/test.py'>
  except: pass

In other words, code executes as described in "Expected result", but also 
prints a warning to stderr about the file object not being closed.

For the second code sample:

$ python3 "/home/anthony/Desktop/test.py"
Traceback (most recent call last):
  File "/home/anthony/Desktop/test.py", line 11, in 
assert not f.closed, "After opening with AIFC"
AssertionError: After opening with AIFC

In other words, code runs normally until the inner context manager exits, and 
the file object gets closed, even though the file object wasn't opened by 
``aifc``.

Solution


Attached are patches that fix each issue separately - the first patch fixes the 
first mentioned issue, while the second patch fixes both at once.

Backwards compatibility:

* The first patch, "fix_aifc_leak.patch", makes no functionality changes, so 
there shouldn't be any backwards compatibility concerns.
* The second patch, "fix_aifc_leak_and_file_object_close.patch", slightly 
changes the behaviour of `aifc_instance.close()` so that it closes in only a 
subset of cases it would originally. While it is possible for this to lead to 
leaks in certain cases (example below), the impact shoul be low, as existing 
codebases seem to use context managers and similar constructs that clean 
everything up properly.

#!/usr/bin/env python3

from os import path
FILE = path.expanduser("~/cpython/Lib/test/audiodata/pluck-pcm8.aiff")
import aifc
f = open(FILE, "rb")
with aifc.open(f, "rb"):
pass
# with the patch applied, `f` is not closed at this point anymore

[1]: https://docs.python.org/3/library/aifc.html#aifc.aifc.close
[2]: https://docs.python.org/3/library/wave.html#wave.Wave_read.close

--
components: Library (Lib)
files: fix_aifc_leak.patch
keywords: patch
messages: 284299
nosy: azhang
priority: normal
severity: normal
status: open
title: [patch] Fix file object leak in `aifc.open` when given invalid AIFF file.
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file46087/fix_aifc_leak.patch

___
Python tracker 

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



[issue29109] Small doc improvements for tracemalloc

2016-12-29 Thread Loic Pefferkorn

New submission from Loic Pefferkorn:

Hello,

I believe that some improvements can be made to the Python 3.4 documentation of 
the tracemalloc module:

* Wrong parameter name, 'group_by' instead of 'key_type' (checked in 
tracemalloc.py)
* Don't round up numbers when explaining the examples. If they exactly match 
what can be read in the script output, it is to easier to understand (4.8 MiB 
vs 4855 KiB)
* Fix incorrect method link that was pointing to another module

I will wait for some feedback before checking the 3.5, 3.6 versions, hopefully 
I did not forget something :)

Cheers,
Loic

--
assignee: docs@python
components: Documentation
files: doc_3.4_tracemalloc.diff
keywords: patch
messages: 284298
nosy: docs@python, haypo, loicp
priority: normal
severity: normal
status: open
title: Small doc improvements for tracemalloc
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file46086/doc_3.4_tracemalloc.diff

___
Python tracker 

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



[issue27867] various issues due to misuse of PySlice_GetIndicesEx

2016-12-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Renamed _PySlice_EvalIndices() to _PySlice_AdjustIndices() and changed its 
signature. Updated the documentation and python3.def. Fixed yet one bug: 
implementation-defined behavior with division by negative step.

Note that since new functions are used in public macro, they become a part of 
the stable API. Shouldn't starting underscores be removed from names?

An attempt of discussing names and signatures on Python-Dev: 
https://mail.python.org/pipermail/python-dev/2016-December/147048.html.

--
Added file: http://bugs.python.org/file46085/slice_get_indices_2.patch

___
Python tracker 

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



[issue29108] Python 3.6.0 multiprocessing map_async callback

2016-12-29 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +davin

___
Python tracker 

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



[issue29108] Python 3.6.0 multiprocessing map_async callback

2016-12-29 Thread Jose Miguel Colella

Jose Miguel Colella added the comment:

The result is:
Here: [1, 4, 9]
[1, 4, 9]

--

___
Python tracker 

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



[issue29108] Python 3.6.0 multiprocessing map_async callback

2016-12-29 Thread Jose Miguel Colella

New submission from Jose Miguel Colella:

Hello I am trying to use the callback for the map_async method for Pool, but 
have found a bug. In the below code, only the print statement is carried out, 
the return is completely ignored. Is this working as designed or is this a bug?

from multiprocessing import Pool


def f(x):
return x * x


def s(x):
print(f'Here: {x}')
return type(x)


if __name__ == '__main__':
with Pool(5) as p:
result = p.map_async(f, [1, 2, 3], callback=s)
q = result.get()
print(q)

--
components: Library (Lib)
files: main2.py
messages: 284295
nosy: Jose Miguel Colella
priority: normal
severity: normal
status: open
title: Python 3.6.0 multiprocessing map_async callback
type: behavior
versions: Python 3.6
Added file: http://bugs.python.org/file46084/main2.py

___
Python tracker 

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



[issue28945] get_boundary (and get_filename) invokes unquote twice

2016-12-29 Thread bpoaugust

bpoaugust added the comment:

This is actually a bug in collapse_rfc2231_value: issue29020

--

___
Python tracker 

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



[issue29020] collapse_rfc2231_value has inconsistent unquoting

2016-12-29 Thread bpoaugust

bpoaugust added the comment:

I have just checked and AFAICT collapse_rfc2231_value is only called by 
get_filename and get_boundary in message.py.

Both of these call get_param and default to unquote=True.

So in all cases the parameter value passed to collapse_rfc2231_value will 
already have been unquoted. Calling unquote again is a bug.

The obvious fix is to remove the calls to unquote from collapse_rfc2231_value.

This will also fix issue28945.

--

___
Python tracker 

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



[issue29053] Implement >From_ decoding on input from mbox

2016-12-29 Thread bpoaugust

Changes by bpoaugust :


--
versions: +Python 3.5 -Python 3.7

___
Python tracker 

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



[issue27867] various issues due to misuse of PySlice_GetIndicesEx

2016-12-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
versions: +Python 2.7, Python 3.7

___
Python tracker 

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



[issue29028] Use-After-Free in PyString_FromStringAndSize() of stringobject.c

2016-12-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue29028] Use-After-Free in PyString_FromStringAndSize() of stringobject.c

2016-12-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There a problem with PySlice_GetIndicesEx() (see issue27867). Buffer length 
shouldn't be evaluated before PySlice_GetIndicesEx() since it can call user 
code that can change buffer length. This issue can't be solved without first 
solving issue27867.

get_buf() is called twice. First for getting the size, and later in 
buffer_item() or after PySlice_GetIndicesEx() for getting a pointer. I think it 
can be called once.

Ammar, please write a unittest for this issue. It should also cover bugs in the 
first two versions of the patch.

--
dependencies: +various issues due to misuse of PySlice_GetIndicesEx

___
Python tracker 

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



[issue29028] Use-After-Free in PyString_FromStringAndSize() of stringobject.c

2016-12-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue29099] sqlite3 timestamp converter cannot handle timezone

2016-12-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

In general the patch LGTM. Added comments on Rietveld.

--

___
Python tracker 

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



[issue29102] Add an id field to PyInterpreterState.

2016-12-29 Thread Eric Snow

Eric Snow added the comment:

Interpreter states are in a linked list, so you

can traverse the list to find one by ID.

Exactly.  At first I had added a PyInterpreterState_FindByID() or something
like that.  However, as you noted, I realized it wasn't necessary. :)

WRT weakrefs, we can't use them directly, but I suspect the higher-level
API will need it...

Everything you said about weakrefs sounds good.  We can discuss more when
we get to that high-level API.

--

___
Python tracker 

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



[issue29028] Use-After-Free in PyString_FromStringAndSize() of stringobject.c

2016-12-29 Thread Ammar Askar

Ammar Askar added the comment:

Updated patch based on Rietveld review

--
Added file: http://bugs.python.org/file46083/buffer-use-after-free-fix.patch2

___
Python tracker 

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



[issue26631] Unable to install Python 3.5.1 on Windows 10 - Error 0x80070643: Failed to install MSI package.

2016-12-29 Thread Skye

Skye added the comment:

The problem is gone. Thank you, for all your work!

--

___
Python tracker 

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



[issue29107] traceback module incorrectly formats args-less syntax errors

2016-12-29 Thread Naftali Harris

New submission from Naftali Harris:

The traceback documentation states that it "exactly mimics the behavior of the 
Python interpreter when it prints a stack trace." Here's a small case where it 
doesn't, on 2.7.13:

~/repos/Python-2.7.13$ cat example.py
def f(x):
global x
~/repos/Python-2.7.13$ ./python.exe
Python 2.7.13 (default, Dec 29 2016, 09:54:42)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import traceback
>>> import example
Traceback (most recent call last):
  File "", line 1, in 
  File "example.py", line 1
def f(x):
SyntaxError: name 'x' is local and global
>>> try:
... import example
... except:
... traceback.print_exc()
...
Traceback (most recent call last):
  File "", line 2, in 
SyntaxError: name 'x' is local and global (example.py, line 1)
>>>

I believe Kurt fixed this for Python 3000 with 
https://mail.python.org/pipermail/python-3000-checkins/2007-July/001259.html

--
components: Library (Lib)
messages: 284287
nosy: Naftali.Harris, benjamin.peterson, kbk
priority: normal
severity: normal
status: open
title: traceback module incorrectly formats args-less syntax errors
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



[issue29099] sqlite3 timestamp converter cannot handle timezone

2016-12-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
stage: test needed -> patch review
Added file: http://bugs.python.org/file46082/sqlite3-2.patch

___
Python tracker 

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



[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2016-12-29 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

I think we should just clip the negative lower probe value to 0 on Windows 
before passing it to local().  Also, if we still care about platforms with 
32-bit time_t, we should check for over/under flow *before* calling local().

--

___
Python tracker 

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



[issue29033] Windows Python installer rolls back when run under SYSTEM account (SCCM)

2016-12-29 Thread Steve Dower

Steve Dower added the comment:

Does SCCM support dependency provider keys? If so, Python 3.6.0 and 3.5.3 and 
later will set one of these (see issue28846), which should make it easier to 
detect the whole bundle. Previous versions of 3.5 used a random GUID here.

I managed to reproduce the issue on a test machine by running a per-user 
install as admin, then the per-machine install. I tried a few ideas to treat 
the per-user and per-machine installs more distinctly, but nothing seems to 
work well. Most likely, I'll just have to add a more serious block when there's 
an existing install and prevent the second bad installation, though I haven't 
yet figured out how to do that.

--

___
Python tracker 

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



[issue29099] sqlite3 timestamp converter cannot handle timezone

2016-12-29 Thread Bozo Kopic

Changes by Bozo Kopic :


Added file: http://bugs.python.org/file46081/sqlite3-2.patch

___
Python tracker 

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



[issue29099] sqlite3 timestamp converter cannot handle timezone

2016-12-29 Thread Bozo Kopic

Changes by Bozo Kopic :


Removed file: http://bugs.python.org/file46075/sqlite3-2.patch

___
Python tracker 

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



[issue29095] Compiling Python 3.6 from source on MacOS X Sierra

2016-12-29 Thread Walter Dörwald

Walter Dörwald added the comment:

OK, with the fixed CFLAGS definition I do indeed get a working ssl module.

I wonder whether the link Ned posted should be put into the README file.

Anyway I think the issue can be closed. Thanks for the help!

--

___
Python tracker 

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



[issue29102] Add an id field to PyInterpreterState.

2016-12-29 Thread Steve Dower

Steve Dower added the comment:

That's an issue with TLS initialisation, not thread IDs. It's easily solved by 
defining an "uninitialized" value (e.g. 0) and an "invalid" value (e.g. -1).

Interpreter states are in a linked list, so you can traverse the list to find 
one by ID.

WRT weakrefs, we can't use them directly, but I suspect the higher-level API 
will need it. Possibly adding a callback on finalisation would fill both needs, 
but I like having a reliable ID - otherwise we'll probably end up with multiple 
different IDs managed indirectly via callbacks. (Perhaps a single callback for 
when any interpreter is finalized that passes the ID through? That should work 
well, since the ID is designed to outlive the interpreter itself, so it can be 
an asynchronous notification.)

--

___
Python tracker 

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



[issue29106] get-pip.py fails with Python 3.6 embed Windows

2016-12-29 Thread Ammar Askar

Ammar Askar added the comment:

Please post this issue on pypa's get-pip issue tracker 
https://github.com/pypa/get-pip

--
nosy: +ammar2
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



[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2016-12-29 Thread Ammar Askar

Ammar Askar added the comment:

I just ran the following script to check if there are any folds from timestamps 
[0, 86399] in any timezone.

  import datetime
  import pytz

  for tz in pytz.all_timezones:
  tz = pytz.timezone(tz)
  for i in range(86400):
  if datetime.datetime.fromtimestamp(i, tz).fold == 1:
  print(str(tz)) 

and it turns out there aren't any. I highly doubt any timezone is going to 
retroactively enable/disable DST during the epoch, so a potentially hacky fix 
is to just have a windows specific check for this value range.

I'm adding the people involved in PEP 495 to the nosy list so they can give 
their input.

--
nosy: +tim.peters

___
Python tracker 

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



[issue29102] Add an id field to PyInterpreterState.

2016-12-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There is an issue with integer identifiers of threads. See issue25658 and 
https://mail.python.org/pipermail/python-ideas/2016-December/043983.html.

--

___
Python tracker 

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



[issue29106] get-pip.py fails with Python 3.6 embed Windows

2016-12-29 Thread Szabolcs Dombi

New submission from Szabolcs Dombi:

Downloaded python 3.6 embedable zip file (windows 32 bit)

Downloaded get-pip.py from the following URL:
https://pip.pypa.io/en/stable/installing/

This is the traceback:

Traceback (most recent call last):
  File "get-pip.py", line 20061, in 
main()
  File "get-pip.py", line 194, in main
bootstrap(tmpdir=tmpdir)
  File "get-pip.py", line 82, in bootstrap
import pip
  File "", line 961, in _find_and_load
  File "", line 950, in _find_and_load_unlocked
  File "", line 646, in _load_unlocked
  File "", line 616, in _load_backward_compatible
  File "C:\Users\User\AppData\Local\Temp\tmpinoq60hn\pip.zip\pip\__init__.py", 
line 26, in 
  File "", line 961, in _find_and_load
  File "", line 950, in _find_and_load_unlocked
  File "", line 646, in _load_unlocked
  File "", line 616, in _load_backward_compatible
  File 
"C:\Users\User\AppData\Local\Temp\tmpinoq60hn\pip.zip\pip\utils\__init__.py", 
line 23, in 
  File "", line 961, in _find_and_load
  File "", line 950, in _find_and_load_unlocked
  File "", line 646, in _load_unlocked
  File "", line 616, in _load_backward_compatible
  File "C:\Users\User\AppData\Local\Temp\tmpinoq60hn\pip.zip\pip\locations.py", 
line 88, in 
  File "ntpath.py", line 75, in join
TypeError: expected str, bytes or os.PathLike object, not NoneType

--
messages: 284279
nosy: Szabolcs Dombi
priority: normal
severity: normal
status: open
title: get-pip.py fails with Python 3.6 embed Windows
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



[issue29102] Add an id field to PyInterpreterState.

2016-12-29 Thread Eric Snow

Eric Snow added the comment:

Three reasons come to mind:

1. threads are identified by small integers
2. long, random-looking IDs are not human-friendly, and subinterpreter IDs will 
be used like thread IDs are
3. related to what Steve said, temporally unique IDs allow us to be confident 
about whether or not an interpreter has been destroyed (and how many 
interpreters there have been)

Since PyInterpreterState is not a PyObject, using weakrefs to address the third 
point won't work, right?

--

___
Python tracker 

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



[issue29105] code or doc improvement for logging.handlers.RotatingFileHandler

2016-12-29 Thread iMath

New submission from iMath:

For 
class logging.handlers.RotatingFileHandler(filename, mode='a', maxBytes=0, 
backupCount=0, encoding=None, delay=0) 

if backupCount is zero and maxBytes is non-zero, the log file size could exceed 
maxBytes, i.e. we are not able to restrict the log file size using 
RotatingFileHandler at this case .
I suggest add the above description to the doc 
https://docs.python.org/3.6/library/logging.handlers.html#logging.handlers.RotatingFileHandler
If possible , set backupCount=1 by default to avoid this pitfall as much as 
possible.

The doc right now just says "if either of maxBytes or backupCount is zero, 
rollover never occurs.", it is too difficult to understand the meaning of 
'Rollover' to aviod the pitfall .

--
assignee: docs@python
components: Documentation
messages: 284277
nosy: docs@python, redstone-cold
priority: normal
severity: normal
status: open
title: code or doc improvement for logging.handlers.RotatingFileHandler
type: enhancement
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



[issue29102] Add an id field to PyInterpreterState.

2016-12-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

If add an API for getting an unique ID of the interpreter state, is it needed 
to add an API for getting the interpreter state by ID?

--

___
Python tracker 

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



[issue5215] change value of local variable in debug

2016-12-29 Thread Андрей Бодров

Андрей Бодров added the comment:

I still can reproduce this bug, is that intended behavior?
  1 def func():
  2   import pdb; pdb.set_trace()
  3   x = 0
  4   y = 0
  5   z = 0
  6 
  7 if __name__ == "__main__":
  8   func()

> /test.py(3)func()
-> x = 0
(Pdb) n
> /test.py(4)func()
-> y = 0
(Pdb) x = 5
(Pdb) y = 3
(Pdb) j 5
> /test.py(5)func()
-> z = 0
(Pdb) x
0
(Pdb) y
*** NameError: name 'y' is not defined

--
nosy: +Андрей Бодров
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



[issue29095] Compiling Python 3.6 from source on MacOS X Sierra

2016-12-29 Thread Ned Deily

Ned Deily added the comment:

See the Developers Guide for more information on build dependencies and 
recommended ways to satisfy OpenSSL dependencies:

http://cpython-devguide.readthedocs.io/en/latest/setup.html#build-dependencies

--
nosy: +ned.deily
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



[issue29102] Add an id field to PyInterpreterState.

2016-12-29 Thread Steve Dower

Steve Dower added the comment:

Tracking purposes mainly, so someone outside the interpreter state can tell 
when it's no longer there. Making interpreter states weak-referencable would 
have a similar effect, and could very well use this id if we didn't need the 
callback.

--

___
Python tracker 

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



[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2016-12-29 Thread Ammar Askar

Ammar Askar added the comment:

The 86,399 upperbound comes from this line (max_fold_seconds=86400):

https://github.com/python/cpython/blob/master/Modules/_datetimemodule.c#L4277-L4278

The bug is introduced as part of the fold detection in this commit: 
https://github.com/python/cpython/commit/56376cacd2a0f6af834fe4d2a20b1a1095afb26f

Window's locatime_s function gives an EINVAL error when time is less than 0. 
Which is where the OSError comes from.

https://msdn.microsoft.com/en-us/library/a442x3ye.aspx

--

___
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

2016-12-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Proposed patch fixes parsing backslashes in f-strings.

P.S. Definitely we should find other name for this term. I hate misleading 
"f-string".

--
keywords: +patch
Added file: http://bugs.python.org/file46080/fstring_backslash.patch

___
Python tracker 

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



[issue29003] sqlite3: can't run VACUUM on Python 3.6

2016-12-29 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for trying pre-release versions of Python 3.6, Ma Lin. This has already 
been reported in issue 28518 so I'm closing this as a duplicate.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> execute("begin immediate") throwing OperationalError

___
Python tracker 

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



[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2016-12-29 Thread R. David Murray

R. David Murray added the comment:

Sounds like it really is an OSError (that is, that the Windows OS is the source 
of the error).  Whether or not we can or should do something about that is a 
separate question, though.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue28518] execute("begin immediate") throwing OperationalError

2016-12-29 Thread Aviv Palivoda

Aviv Palivoda added the comment:

Issue #29003 seems to be related to this one. I think that they can be solved 
the same way as done in Serhiy patch but I would like to suggest a different 
approach.
I suggest changing the check for DDL statement with a check for DML statement. 
We actually should start a transaction only for DML statements 
(https://docs.python.org/3/library/sqlite3.html#controlling-transactions) so 
all other statements (DDL, DCL and TCL) should not start a transaction.
The attached patch solve both this issue and issue #29003.

--
Added file: http://bugs.python.org/file46079/sqlite-ddl-dml.patch

___
Python tracker 

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



[issue29103] Make enum.py pep8 compliant

2016-12-29 Thread R. David Murray

R. David Murray added the comment:

In general we do not accept PEP8 patches; it is code churn with insufficient 
benefit since many modules in the stdlib predate either PEP8 itself or the 
current version of PEP8.  However, enum is a new enough module that I suppose 
this might get accepted.  In any case, thank you for wanting to contribute!

--
nosy: +r.david.murray

___
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

2016-12-29 Thread Eric V. Smith

Eric V. Smith added the comment:

This problem was no doubt introduced after 3.6a1 when I changed the parsing to 
disallow backslashes inside {}.

--

___
Python tracker 

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



[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2016-12-29 Thread SilentGhost

SilentGhost added the comment:

Cannot reproduce this with the tip on linux

--

___
Python tracker 

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



[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2016-12-29 Thread SilentGhost

Changes by SilentGhost :


--
components: +Windows
nosy: +belopolsky, paul.moore, steve.dower, tim.golden, zach.ware
stage:  -> needs patch
type:  -> behavior

___
Python tracker 

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



[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2016-12-29 Thread Ammar Askar

Ammar Askar added the comment:

Can recreate successfully on windows, but not on linux:

> C:\Python36\python.exe -c "import datetime; 
> datetime.datetime.fromtimestamp(42)"
Traceback (most recent call last):
  File "", line 1, in 
OSError: [Errno 22] Invalid argument

> C:\Python36\python.exe
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime; datetime.datetime.fromtimestamp(42)
Traceback (most recent call last):
  File "", line 1, in 
OSError: [Errno 22] Invalid argument

--
nosy: +ammar2

___
Python tracker 

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



[issue29095] Compiling Python 3.6 from source on MacOS X Sierra

2016-12-29 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

Change this line:

export CFLAGS="-I/usr/local/Cellar/openssl/1.0.2j/include/openssl"

into:

export CFLAGS="-I/usr/local/Cellar/openssl/1.0.2j/include"

--

___
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

2016-12-29 Thread Eric V. Smith

Eric V. Smith added the comment:

Yes:

>>> f'\{2*5}'
'\\{10'

I agree '\\10' would make sense.

--

___
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

2016-12-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The problem is not that the trailing } is dropped, but that the starting { 
starts an f-string expression.

>>> f'\{2*5}'
'\\{10'

I expected either '\\10' as in '\{}'.format(2*5), or at least '\\{2*5}'.

There is other f-string parsing error:

>>> f'\\N{2*5}'
'\\N{2*5}'

I expected '\\N10'. '\\N' doesn't start a unicode name escape. This is a 
legitimate expression.

--
nosy: +serhiy.storchaka

___
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

2016-12-29 Thread Jim Fasarakis-Hilliard

Jim Fasarakis-Hilliard added the comment:

Yes, should've attached in my previous message. See 
http://stackoverflow.com/questions/41330097/why-does-the-symbol-remain-when-f-10-is-evaluated-in-python-3-6

--

___
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

2016-12-29 Thread Eric V. Smith

Eric V. Smith added the comment:

Do you have a link to the SO question?

--

___
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

2016-12-29 Thread Jim Fasarakis-Hilliard

Jim Fasarakis-Hilliard added the comment:

I see, the original "complaint" about this behavior on stack overflow was made 
due to the discrepancy between the f-string the the format "equivalent": 
'\{}'.format(10)'.

--

___
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

2016-12-29 Thread Eric V. Smith

Eric V. Smith added the comment:

But I admit that dropping the trailing } seems odd. I think this particular 
usage should be an error: no bare } allowed, similar to:

>>> f'10}'
  File "", line 1
SyntaxError: f-string: single '}' is not allowed

--

___
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

2016-12-29 Thread Eric V. Smith

Eric V. Smith added the comment:

I'm not sure this counts as an error. The backslash means to treat the next 
character literally, which this does. And since \{ is not a valid escape 
sequence, it keeps both characters, exactly like:

>>> '\c'
'\\c'

Furthermore, since unknown escape sequences are deprecated, this usage is going 
to be an error in the future. You can see this now with -Werror:

$ python.exe  -Werror
Python 3.6.0b1+ (3.6:87de1f12c41c+, Sep 16 2016, 07:05:57) [MSC v.1900 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> f'\{10}'
DeprecationWarning: invalid escape sequence '\{'
>>> '\c'
DeprecationWarning: invalid escape sequence '\c'
>>>

Since this works as I expect it to now, and since it will become an error in 
the future, I don't think any change is warranted.

--
assignee:  -> eric.smith

___
Python tracker 

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



[issue28978] a redundant right parentheses in the EBNF rules of parameter_list

2016-12-29 Thread Jim Fasarakis-Hilliard

Jim Fasarakis-Hilliard added the comment:

Further patch for 3.6 and 3.7 to address `defparameter` change here too.

--
Added file: http://bugs.python.org/file46078/3.6_3.7_func_def.patch

___
Python tracker 

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



[issue28978] a redundant right parentheses in the EBNF rules of parameter_list

2016-12-29 Thread Jim Fasarakis-Hilliard

Jim Fasarakis-Hilliard added the comment:

Further patch for `3.4` and `3.5`:

Change `|` to `(` and fix `defparameter` to use `+`

--
Added file: http://bugs.python.org/file46077/3.4_3.5_func_def.patch

___
Python tracker 

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



[issue28978] a redundant right parentheses in the EBNF rules of parameter_list

2016-12-29 Thread Jim Fasarakis-Hilliard

Jim Fasarakis-Hilliard added the comment:

Attached patche for Python 3.3 (change `defparameter` to use `+`).

--
keywords: +patch
Added file: http://bugs.python.org/file46076/3.3_func_def.patch

___
Python tracker 

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



[issue29099] sqlite3 timestamp converter cannot handle timezone

2016-12-29 Thread Bozo Kopic

Changes by Bozo Kopic :


Added file: http://bugs.python.org/file46075/sqlite3-2.patch

___
Python tracker 

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



[issue29099] sqlite3 timestamp converter cannot handle timezone

2016-12-29 Thread Bozo Kopic

Changes by Bozo Kopic :


Removed file: http://bugs.python.org/file46074/sqlite3-2.patch

___
Python tracker 

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



[issue29099] sqlite3 timestamp converter cannot handle timezone

2016-12-29 Thread Bozo Kopic

Bozo Kopic added the comment:

I'm providing new patch that adds support for parsing timezone information.

Tests are included.

--
Added file: http://bugs.python.org/file46074/sqlite3-2.patch

___
Python tracker 

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



[issue29095] Compiling Python 3.6 from source on MacOS X Sierra

2016-12-29 Thread Walter Dörwald

Walter Dörwald added the comment:

OK, I've set CFLAGS and LDFLAGS as you suggested. However the ssl module still 
doesn't get built. Attached is the new build log (Python3.6-build2.log)

--
Added file: http://bugs.python.org/file46073/Python3.6-build2.log

___
Python tracker 

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



[issue29097] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2016-12-29 Thread SilentGhost

SilentGhost added the comment:

This doesn't seem likely that it's anything to do with datetime, could you try 
reproducing it in repl?

--
nosy: +SilentGhost

___
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

2016-12-29 Thread SilentGhost

Changes by SilentGhost :


--
nosy: +eric.smith
type:  -> behavior

___
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

2016-12-29 Thread Jim Fasarakis-Hilliard

New submission from Jim Fasarakis-Hilliard:

In short:

>>> f"\{10}"

yields:

"\\{10"

This is reproducible only when `\` precedes the opening bracket, that is:

>>> f"\ {10}"

results in: "\\ 10"

--
components: Interpreter Core
messages: 284249
nosy: Jim Fasarakis-Hilliard
priority: normal
severity: normal
status: open
title: Left bracket remains in format string result when '\' preceeds it
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



[issue29095] Compiling Python 3.6 from source on MacOS X Sierra

2016-12-29 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

Ah, things are quite the opposite :)

You have to set CFLAGS and LDFLAGS so that setup.py can find openssl headers 
and libraries from Homebrew. For example:

export CFLAGS="-I/usr/local/opt/openssl/include"
export LDFLAGS="-L/usr/local/opt/openssl/lib"

The reason for that is that Apple once shipped their forked OpenSSL in older 
Mac OS X versions, so Homebrew can't install OpenSSL headers and libraries to 
public paths (/usr/local/include & /usr/local/lib). On the other hand, CPython 
should not use paths in /usr/local/opt/ as it's internal details of Homebrew.

--

___
Python tracker 

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



[issue24875] pyvenv doesn´t install PIP inside a new venv with --system-site-package

2016-12-29 Thread Jan Gosmann

Changes by Jan Gosmann :


--
nosy: +jgosmann

___
Python tracker 

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



[issue29095] Compiling Python 3.6 from source on MacOS X Sierra

2016-12-29 Thread Walter Dörwald

Walter Dörwald added the comment:

No, neither CFLAGS nor LDFLAGS are set, the only "FLAGS" environment variable I 
have set is ARCHFLAGS='-arch x86_64' (I can't remember why). However unsetting 
this variable doesn't change the result.

--

___
Python tracker 

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



[issue28961] unittest.mock._Call ignores `name` parameter

2016-12-29 Thread Jiajun Huang

Jiajun Huang added the comment:

hi, do this need more test case or something else to be merged? please let me 
know :)

--

___
Python tracker 

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



[issue29099] sqlite3 timestamp converter cannot handle timezone

2016-12-29 Thread Xiang Zhang

Xiang Zhang added the comment:

import sqlite3, datetime
c = sqlite3.connect(':memory:', 
detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)
cur = c.cursor()
cur.execute('create table test(t timestamp)')
t = datetime.datetime.now(tz=datetime.timezone.utc)
cur.execute("insert into test(t) values (?)", (t,))
cur.execute('select t from test')
l = cur.fetchone()[0]
t == l   # the result not equal to the original one

--

___
Python tracker 

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



[issue28612] str.translate needs a mapping example

2016-12-29 Thread Gaurav Tatke

Gaurav Tatke added the comment:

Hi,

I am new to Python and want to contribute. I am attaching a patch having 
required example of using defaultdict with translate. Please let me know if 
anything needs to be changed. I have tested the example and also the html doc 
in my local.

Regards,
Gaurav

--
keywords: +patch
nosy: +Gaurav Tatke
Added file: http://bugs.python.org/file46072/translateexample_issue28612.patch

___
Python tracker 

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



[issue29099] sqlite3 timestamp converter cannot handle timezone

2016-12-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Could you provide a unittest?

--
nosy: +belopolsky, ghaering, lemburg
stage:  -> test needed

___
Python tracker 

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



[issue26382] List object memory allocator

2016-12-29 Thread INADA Naoki

INADA Naoki added the comment:

OK. I didn't know PyMem and PyObject allocators are always same.
No reason to change Python 3.
How about Python 2?

Off topic: I want to know which of PyMem and PyObject allocator is preferred
when writing new code.

--
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



[issue29099] sqlite3 timestamp converter cannot handle timezone

2016-12-29 Thread Xiang Zhang

Xiang Zhang added the comment:

I would prefer add the support for timezone since the current behaviour seems 
not correct to me. If you'd like to work on it, don't forget to add a test case 
and sign the CLA.

But I am not sure this should be treated as a bug or new feature.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue29099] sqlite3 timestamp converter cannot handle timezone

2016-12-29 Thread Bozo Kopic

Bozo Kopic added the comment:

Yes, that is correct. Timezone information is discarded. Submitted patch only 
resolves occurrence of ValueError.

Is additional patch that enables parsing of timezone required?

--

___
Python tracker 

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



  1   2   >