[issue29062] hashlib documentation link error

2016-12-30 Thread INADA Naoki

INADA Naoki added the comment:

May I commit merge-hashlib-blake2.patch to 3.6 branch?

--

___
Python tracker 

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



[issue29119] Unintentional hard reference assignment in Python version of OrderedDict.move_to_end

2016-12-30 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I'm leaving this for Andra Bogildea to work through and comment on.  

Testing is likely to be awkward at best.  It would involve white box 
implementation specific steps like accessing the name managed variables and 
rotating through the doubly linked list to verify that all the prev-links have 
the type, .

--

___
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-30 Thread Nick Coghlan

Nick Coghlan added the comment:

Yeah, I'm also fine with using int_fast64_t for the subinterpreter count.

The only thing I'm really advocating for strongly on that front is that I think 
it makes sense to sacrifice the sign bit in the ID field as an error indicator 
that provides a more idiomatic C API.

--

___
Python tracker 

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



[issue29119] Unintentional hard reference assignment in Python version of OrderedDict.move_to_end

2016-12-30 Thread Raymond Hettinger

Changes by Raymond Hettinger :


Added file: http://bugs.python.org/file46099/od_proxy2a.diff

___
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-30 Thread Ma Lin

Ma Lin added the comment:

I have no idea about how to fix it, but I would like to suggest that add back 
this test which was removed in commit 284676cf2ac8 :

file: /Lib/sqlite3/test/transactions.py
def CheckVacuum(self):
self.cur.execute("create table test(i)")
self.cur.execute("insert into test(i) values (5)")
self.cur.execute("vacuum")

Thank you for your efforts! regards.

--
nosy: +Ma Lin

___
Python tracker 

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



[issue29116] Make str and bytes error messages on concatenation conform with other sequences

2016-12-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Originally this issue was raised on StackOverflow:

http://stackoverflow.com/questions/41388606/python-3-6-vs-3-5-typeerror-message-on-string-concatenation

--

___
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-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your patches Anthony. Could you please create a unittest for the 
first issue?

The second issue is well known. Since the behavior is documented, I think it 
can be changed only in Python 3.7. The patch needs the "versionchanged" 
directives in the documentation and documenting the change in What's New (in 
the section "Porting to Python 3.7" or like). This change can cause reference 
leaks in existing code.

This is not the only inconsistency between aifc and similar modules.

--

___
Python tracker 

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



[issue29116] Make str and bytes error messages on concatenation conform with other sequences

2016-12-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Different cases accept different types. Not always we can say that only one 
specific type is accepted.

"list +" accepts only lists, "list +=" is a syntax sugar for list.extend and 
accepts any iterables. "bytes +" and "bytearray +=" accept any objects that 
support the buffer protocol. "array +" and "array +=" accept only arrays.

Changing semantic is out of the scope of this issue. I think there are reasons 
for current behavior.

--

___
Python tracker 

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



[issue29059] Windows: Python not using ANSI compatible console

2016-12-30 Thread Glenn Linderman

Glenn Linderman added the comment:

Re: curses... maybe that becomes a DOCS issue, to mention the available 
packages. But it would be easier, no doubt to port curses to a known existing 
escape sequence control set, than to use a bunch arcane, 
foreign-to-the-Unix-porter-that-wants-curses obscure and seldom discussed 
Windows APIs.

IIRC, ANSI is somewhat incompatible with sending random binary gibberish to the 
screen, as people accidentally do with TYPE sometimes :) But the random binary 
gibberish may contain ANSI control sequences... That's why I'm negative on 
making it a default.

--

___
Python tracker 

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



[issue29119] Unintentional hard reference assignment in Python version of OrderedDict.move_to_end

2016-12-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Makes sense. Any chance to create tests?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue29119] Unintentional hard reference assignment in Python version of OrderedDict.move_to_end

2016-12-30 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
priority: normal -> low
Added file: http://bugs.python.org/file46098/od_proxy2.diff

___
Python tracker 

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



[issue29119] Unintentional hard reference assignment in Python version of OrderedDict.move_to_end

2016-12-30 Thread Raymond Hettinger

New submission from Raymond Hettinger:

The root.prev and first.prev assignments should use weak references rather than 
hard references.  Spotted by Andra Bogildea.

--
components: Library (Lib)
files: od_proxy.diff
keywords: patch
messages: 284367
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Unintentional hard reference assignment in Python version of 
OrderedDict.move_to_end
type: resource usage
versions: Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file46097/od_proxy.diff

___
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-30 Thread Steve Dower

Steve Dower added the comment:

I fully expect subinterpreters to have a serious role in long running 
applications like web servers or other agents (e.g. cluster nodes), so I'd 
rather just bite the bullet and take 64-bits now so that we can completely 
neglect reuse issues. Otherwise we'll find ourselves adding infrastructure to 
hide the fact that you may see the same id twice.

Another four bytes is a cheap way to avoid an entire abstraction layer.

--

___
Python tracker 

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



[issue29059] Windows: Python not using ANSI compatible console

2016-12-30 Thread Steve Dower

Steve Dower added the comment:

I suspect curses could be updated to fully support Windows, even without the 
VT100 mode (all the functionality has existed for years, just through a 
different interface). It really just needs someone to take on the project, and 
there are already better options out there (I forget the name, but the IPython 
team are very happy with whatever library they're using these days), so 
possibly it's more of an awareness problem that doesn't need to be solved in 
the core distro.

--

___
Python tracker 

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



[issue29076] Py 3.6 Mac installer doesn't update "python3" shell command

2016-12-30 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
title: Python 3.6 installer doesn't update "python3" shell command -> Py 3.6 
Mac installer doesn't update "python3" shell command

___
Python tracker 

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



[issue29075] Remove Windows Vista support

2016-12-30 Thread Terry J. Reedy

Terry J. Reedy added the comment:

How certain are you that Vista support will actually end?

Other things: assuming reasonable certainty, could the 3.6 installer say "This 
is the last version that will run on Vista!"?

--
nosy: +terry.reedy

___
Python tracker 

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



[issue29059] Windows: Python not using ANSI compatible console

2016-12-30 Thread Glenn Linderman

Glenn Linderman added the comment:

Nice idea, but not by default. An easy way to switch back and forth, and to be 
sure the original mode is restored on process exit would be a win.

Most windows users want a real GUI, not curses, but compatibility with VT 
escape codes for cross-platform semi-GUI stuff could be useful... and could 
enable the stdlib curses to be included in Python for windows also? I'm not 
sure why it isn't, and "ANSI" a.k.a. VT escape codes have been available in 
Windows for a long time... but until Python 3.6.0 (thanks again Steve, and 
others), Windows console handling in Python has been extremely limited.

Also note that UniCurses and Pygcurse exist and provide similar capabilities.

--
nosy: +v+python

___
Python tracker 

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



[issue29118] Randit

2016-12-30 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Also, wherever you post, copy and paste the traceback instead of adding a link 
to an image.

--

___
Python tracker 

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



[issue29118] Randit

2016-12-30 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This issue has nothing to do with IDLE.  There is also no bug here.  Python's 
random module has a randint function that works fine.  Either you or the book 
have misspelled 'randint' as 'randit' or the book is using its own random 
module and not the stdlib version.  Please post on python-list if you think you 
have found a bug.

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



[issue24932] Use proper command line parsing in _testembed

2016-12-30 Thread Nick Coghlan

Nick Coghlan added the comment:

Steve's patch LGTM, and I now agree our needs are simple enough that we can 
rely on subprocess+unittest for the result reporting.

I'd just missed Steve's simple solution of using the return code to indicate 
success or failure, as well as Eric's approach in issue 29102 of teaching the 
related Python test case to read the text output from the _testembed test case.

If we eventually want to go beyond the single "run this test case" argument, 
then adding getopt() support to _testembed should be sufficient.

--

___
Python tracker 

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



[issue24932] Use proper command line parsing in _testembed

2016-12-30 Thread Nick Coghlan

Changes by Nick Coghlan :


--
title: Migrate _testembed to a C unit testing library -> Use proper command 
line parsing in _testembed

___
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-30 Thread Nick Coghlan

Nick Coghlan added the comment:

The concern I have with using an unsigned value as the interpreter ID is that 
it's applying the "NULL means an error" idiom or the "false means an error" 
idiom to a non-pointer and non-boolean return type, whereas the common 
conventions for integer return values are:

* 0 = success in CLI return codes
* non-negative = success in int-based C APIs

If we were to use int_fast32_t for IDs instead, then any negative value can 
indicate an error, and the main interpreter could be given ID 0 to better align 
with the threading.Thread naming scheme.

Whether we hit runtime error at 2 billion subinterpreters or 4 billion 
subinterpreters in a single process isn't likely to make much difference to 
anyone, but choosing an idiosyncratic error indicator will impact everyone that 
attempts to interact with the API.

--

___
Python tracker 

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



[issue29118] Randit

2016-12-30 Thread Spacemage 33

New submission from Spacemage 33:

I have a book with i can learn phyton but in the first Little game there is 
"from random import randit" and the book is for Phyton3 now it do not work im 
realy said about this please fix that

--
assignee: terry.reedy
components: IDLE
files: Screenshot_4.png
messages: 284358
nosy: Spacemage 33, terry.reedy
priority: normal
severity: normal
status: open
title: Randit
versions: Python 3.6
Added file: http://bugs.python.org/file46096/Screenshot_4.png

___
Python tracker 

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



[issue29115] distutils.core.setup does not let people set 'bugtrack_url'.

2016-12-30 Thread Decorater

Decorater added the comment:

In that case why does pypi.python.org not let me change that bug track url 
option or set it anymore?

--

___
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-30 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue29098] document minimum sqlite version

2016-12-30 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +berker.peksag

___
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-30 Thread Naftali Harris

Naftali Harris added the comment:

Adding Georg, who is listed as an expert for the traceback module 
(https://docs.python.org/devguide/experts.html).

--
nosy: +georg.brandl

___
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-30 Thread Naftali Harris

Naftali Harris added the comment:

For your convenience, here is a possible patch fixing these issues. It modifies 
the format_exception_only function in the traceback module to follow the 
behavior of the interpreter a little more closely for SyntaxError's. Feel free 
to use, in whole, in part, or not at all, as you wish. Happy new year! :-)

--
keywords: +patch
Added file: http://bugs.python.org/file46095/traceback_fixes.patch

___
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-30 Thread Christopher Barker

Christopher Barker added the comment:

This all came out of a thread on python-ideas, starting here:

https://mail.python.org/pipermail/python-ideas/2016-October/043284.html

the thread kind of petered out, but it seems there was a kinda-sorta
consensus that we didn't need any new string methods, but rather same notes
in the docs on how to to use .translate() to remove "all but these" was in
order.

And the defaultdict method was proposed as the easiest / most pythonic.

As it happens, I did't live the fact hat defaultdict will build up a
big(ish) dict of Nones for no reason, and thus suggested a NoneDict option:

class NoneDict(dict):
"""
Dictionary implementation that always returns None when a key is not in
the dict,
rather than raising a KeyError
"""
def __getitem__(self, key):
try:
val = dict.__getitem__(self, key)
except KeyError:
val = None
return val

Though maybe that's a bit much for the docs.

However, in short:

either the defaultdict approach is siple and pythonic enough to be in teh
docs, or we SHOULD add something new to the string object.

(or maybe someone has another nifty pythonic way to do this with the stdlib
that's better than defaultdict?)

-CHB

On Fri, Dec 30, 2016 at 12:18 PM, Gaurav Tatke 
wrote:

>
> Gaurav Tatke added the comment:
>
> Should a user be suggested to use str.translate() for the use case where
> user only wants to keep certain characters and strip off everything else?
>
> --
>
> ___
> Python tracker 
> 
> ___
>

-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

chris.bar...@noaa.gov

--
nosy: +Chris.Barker

___
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-30 Thread Eric Snow

Eric Snow added the comment:

Here's the updated patch.

--
Added file: http://bugs.python.org/file46094/interpreter-id-2.diff

___
Python tracker 

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



[issue29115] distutils.core.setup does not let people set 'bugtrack_url'.

2016-12-30 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

I did some more research: setuptools didn't have this keyword either.

It was added to PyPI at some point and then probably got picked up by some 
package authors as new "optional" keyword argument for setup():

http://stackoverflow.com/questions/14459828/how-to-set-bug-tracker-url-in-setup-py-script

There isn't anything we can do about this in the Python stdlib and neither can 
setuptools (except write a filter for it).

It's probably best to let the package authors still using the keyword know that 
they have to remove the keyword settings from their setup.py.

--

___
Python tracker 

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



[issue29115] distutils.core.setup does not let people set 'bugtrack_url'.

2016-12-30 Thread Berker Peksag

Berker Peksag added the comment:

Again, this is not a distutils bug and it has already been reported to the 
setuptools maintainers: https://github.com/pypa/setuptools/issues/29

Quoting from the original report:

> Currently setuptools.dist.Distribution passes the unfiltered collection
> of keyword arguments up to distutils.core.Distribution. This results in
> lots of scary looking "UserWarning" messages when you actually use the
> setuptools-only options

and see also:

> It also makes it look like you're calling distutils rather than setuptools,
> since the stack trace (showing that this is a call up into setuptools)
> isn't visible.

The setuptools maintainer replied (which he also maintains distutils):

> Indeed, setuptools just passes the attributes through directly through to 
> Distribution. [...]

And by the way, I saw your own report while doing a research on this. Quoting 
from https://github.com/pypa/setuptools/issues/906

> [...] So that way setuptools can fix this bug as the standard library devs
> that manage distutils are too lazy to fix it themselves.

Next time I suggest you to do a better research before starting to blame the 
core developers.

--

___
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-30 Thread Eric Snow

Eric Snow added the comment:

> What do you think about resetting the counter back to 1 in Py_Initialize?

Sounds good to me.  When I was working on the patch I had the idea in the back 
of my mind that not resetting the counter would better support interpreter 
separation efforts in the future.  However, after giving it some thought I 
don't think that's the case.  So resetting it in Py_Initialize() is fine with 
me.

> I'll also note that in the threading module, the main thread is
> implicitly thread 0 (but named as MainThread) - Thread-1 is the first
> thread created via threading.Thread. So it may make sense to use a
> signed numeric ID, with 0 being the main interpreter, 1 being the first
> subinterpreter, and negative IDs being errors.

I had considered that and went with an unsigned long.  0 is used for errors, 
and starting at 1, which effectively means the main interpreter is always 1.  
If we later run into overflow issues then we can sort that out at that point 
(e.g. by moving to a 64-bit int or even a Python int).

I'll add comments to the patch regarding these points.

--

___
Python tracker 

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



[issue29115] distutils.core.setup does not let people set 'bugtrack_url'.

2016-12-30 Thread Decorater

Decorater added the comment:

Except for the setup function, yeah. 
https://github.com/pypa/setuptools/blob/master/setuptools/__init__.py#L112

--

___
Python tracker 

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



[issue29116] Make str and bytes error messages on concatenation conform with other sequences

2016-12-30 Thread Jim Fasarakis-Hilliard

Jim Fasarakis-Hilliard added the comment:

Should that message be the one predominantly used for sequences, i.e:

   TypeError: can only concatenate class1 (not "class2") to class1

or should another one be used like "Unsupported operand type(s) for op: 
'class1' and 'class2'?

The first is problematic with cases like `+=` where an iterable is accepted, 
the second seems better to me at least.

As for `operator.concat`, any reason why the check is made beforehand to see if 
the first argument has a `__getitem__` method? Couldn't that just be removed 
allowing the exception from `concat(1, '')` to just propagate to the caller?

--

___
Python tracker 

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



[issue29117] dir() should include dunder attributes of the unbound method

2016-12-30 Thread Antony Lee

New submission from Antony Lee:

```
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.
>>> class C:
... def f(self): pass
... 
>>> C.f.attr = 42
>>> print(dir(C.f))
['__annotations__', '__call__', '__class__', '__closure__', '__code__', 
'__defaults__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', 
'__format__', '__ge__', '__get__', '__getattribute__', '__globals__', '__gt__', 
'__hash__', '__init__', '__kwdefaults__', '__le__', '__lt__', '__module__', 
'__name__', '__ne__', '__new__', '__qualname__', '__reduce__', '__reduce_ex__', 
'__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'attr']
>>> print(dir(C().f))
['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', 
'__format__', '__func__', '__ge__', '__get__', '__getattribute__', '__gt__', 
'__hash__', '__init__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', 
'__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', 
'__str__', '__subclasshook__', 'attr']
>>> 
```

Note that `dir(C().f)` does include the custom `attr` attribute, but is missing 
some of the dunder attributes (e.g. `__annotations__`), which are actually 
accessible directly from the boun method.

--
components: Interpreter Core
messages: 284347
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: dir() should include dunder attributes of the unbound 
method
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



[issue29115] distutils.core.setup does not let people set 'bugtrack_url'.

2016-12-30 Thread R. David Murray

R. David Murray added the comment:

Except that setuptools monkey patches distutiles all over the place.  So no, it 
isn't the same at all.

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



[issue29115] distutils.core.setup does not let people set 'bugtrack_url'.

2016-12-30 Thread Decorater

Decorater added the comment:

So basically what from setuptools import setup is really doing is the same as 
doing from distutils.core import setup

--

___
Python tracker 

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



[issue29115] distutils.core.setup does not let people set 'bugtrack_url'.

2016-12-30 Thread Decorater

Decorater added the comment:

The problem with setuptools on that is that they export their setup like so 
which uses the distutils setup by doing:

setup = distutils.core.setup. That is how they are doing it.

--

___
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-30 Thread Gaurav Tatke

Gaurav Tatke added the comment:

Should a user be suggested to use str.translate() for the use case where user 
only wants to keep certain characters and strip off everything else?

--

___
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-30 Thread Gaurav Tatke

Gaurav Tatke added the comment:

Hi,

Pardon my ignorance, I am new to this but have below queries/thoughts -

1. Why would we say that adding new keys during lookup phase is an unpleasant 
side-effect? From what I understood by docs, one of the main reasons to use 
defaultdicts is to be able to insert a missing key and give a default value to 
it. 'defaultdict' doc itself suggest that doing this is cleaner and faster than 
using dict.setdefault().

2. I believe defaultdict perfectly fits in this context of creating translation 
table for str.translate(). Even if we have very large string containing all 
characters from 4-5 languages, our defaultdict will still be comparatively 
small. It is easier to create a translation table using defaultdict when we 
have to strip most characters out of a string as in the example requested in 
the issue. Creating a translation table using str.maketrans() or by user 
defined function is tricky in this use case.

3. If argument for using defaultdict in this context is not convincing, shall I 
just give a patch, giving example of str.translate() using str.maketranse()?

Regards,

--

___
Python tracker 

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



[issue29116] Make str and bytes error messages on concatenation conform with other sequences

2016-12-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Old error message is misleading. It implied that there are objects that can be 
converted to str implicitly. This was true in Python 2, but is false in Python 
3.

New error message conforms with TypeError messages produced by PyArg_Parse*(). 
It is the same in a number of str methods. It doesn't conform with the error 
messages for other produced by concatenating other types. But different 
messages are generated for different types:

>>> b'' + 1
Traceback (most recent call last):
  File "", line 1, in 
TypeError: can't concat bytes to int
>>> a = bytearray(); a += 1
Traceback (most recent call last):
  File "", line 1, in 
TypeError: can't concat int to bytearray
>>> [] + 1
Traceback (most recent call last):
  File "", line 1, in 
TypeError: can only concatenate list (not "int") to list
>>> a = []; a += 1
Traceback (most recent call last):
  File "", line 1, in 
TypeError: 'int' object is not iterable
>>> import array; array.array('b') + []
Traceback (most recent call last):
  File "", line 1, in 
TypeError: can only append array (not "list") to array
>>> import array; a = array.array('b'); a += []
Traceback (most recent call last):
  File "", line 1, in 
TypeError: can only extend array with array (not "list")
>>> import operator; operator.concat(1, '')
Traceback (most recent call last):
  File "", line 1, in 
TypeError: 'int' object can't be concatenated

I think it would be better to unify them all.

I'm not sure that this change can be considered as a bug fix rather than an 
enhancement. Leave this on 3.6 release manager.

--
assignee:  -> ned.deily
nosy: +ned.deily, serhiy.storchaka

___
Python tracker 

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



[issue29116] Make str and bytes error messages on concatenation conform with other sequences

2016-12-30 Thread Jim Fasarakis-Hilliard

New submission from Jim Fasarakis-Hilliard:

Specifically, bytes (always, from what I could find) had this error message:

>>> b'' + ''
TypeError: can't concat bytes to str

while str, after a change in issue26057, was made to:

>>> '' + b''
TypeError: must be str, not bytes

from the previous form of "TypeError: Can't convert 'bytes' object to str 
implicitly".

I think these could be changed to conform with what the other sequences 
generate and fall in line with the error messages produced for other operations.

Specifically changing them to:

>>> b'' + ''
TypeError: can only concatenate bytes (not 'str') to bytes

and similarly for str.

If this idea makes sense, I can attach a patch that addresses it.

--
components: Interpreter Core
messages: 284340
nosy: Jim Fasarakis-Hilliard
priority: normal
severity: normal
status: open
title: Make str and bytes error messages on concatenation conform with other 
sequences
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



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

2016-12-30 Thread Naftali Harris

Naftali Harris added the comment:

Two other minor discrepancies between the way traceback and the interpreter 
format SyntaxError's, in 2.7.13:

1.

>>> e = SyntaxError("some message", ("myfile.py", None, None, None))
>>> raise e
Traceback (most recent call last):
  File "", line 1, in 
SyntaxError: some message (myfile.py)
>>> try:
... raise e
... except:
... traceback.print_exc()
...
Traceback (most recent call last):
  File "", line 2, in 
Traceback (most recent call last):
  File "", line 4, in 
  File "/Users/naftali/repos/Python-2.7.13/Lib/traceback.py", line 233, in 
print_exc
print_exception(etype, value, tb, limit, file)
  File "/Users/naftali/repos/Python-2.7.13/Lib/traceback.py", line 126, in 
print_exception
lines = format_exception_only(etype, value)
  File "/Users/naftali/repos/Python-2.7.13/Lib/traceback.py", line 188, in 
format_exception_only
lines.append('  File "%s", line %d\n' % (filename, lineno))
TypeError: %d format: a number is required, not NoneType


2.

>>> e = SyntaxError("some message", ("myfile.py", 3, 10, "hello"))
>>> raise e
Traceback (most recent call last):
  File "", line 1, in 
  File "myfile.py", line 3
hello
 ^
SyntaxError: some message
>>> try:
... raise e
... except:
... traceback.print_exc()
...
Traceback (most recent call last):
  File "", line 2, in 
  File "myfile.py", line 3
hello
^
SyntaxError: some message

--

___
Python tracker 

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



[issue24932] Migrate _testembed to a C unit testing library

2016-12-30 Thread Steve Dower

Steve Dower added the comment:

The only real advantage of adding a native unit testing framework here is to 
avoid having to start/destroy _testembed[.exe] multiple times during the test 
run. But given the nature of these tests is highly environmental, I don't think 
we can reasonably avoid it. I'm also highly doubtful that any framework is 
going to actually reduce the work we'd need to do to mock out initialization 
steps.

I've attached a patch that takes the first step towards making _testembed more 
usable, by changing main() to look up a test from a list and execute it, then 
return the exit code. The support in test_capi.EmbeddingTests is neat, so 
adding more tests here will be fairly straightforward.

--
keywords: +patch
nosy: +steve.dower
versions: +Python 3.7
Added file: http://bugs.python.org/file46093/24932_1.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-30 Thread Ethan Furman

Ethan Furman added the comment:

Thanks Raymond and Jean-Sebastien.

--

___
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-30 Thread Nick Coghlan

Nick Coghlan added the comment:

Sorry, I wasn't at all clear about that part - the above techniques should work 
with explicitly created types.MethodType instances as well.

That is, this should work the same as in my earlier examples (although I don't 
have that interpreter session around to test it any more):

>>> b = B()
>>> b.fn = types.MethodType(make_B_method(), b)
>>> b.fn()  # Emulated super()


If you were to build on top of what I wrote above (i.e. setting "B.fn = 
make_B_method()"), that explicit bound method creation would be akin to doing:

>>> b = B()
>>> b.fn = b.fn # Cache the bound method on the instance

--

___
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-30 Thread Steve Dower

Steve Dower added the comment:

> Wouldn't this break the main property of IDs, the uniqueness?

If we bump it up to a 64-bit ID then it'll be no worse than how we track all 
dict mutations.

--

___
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-30 Thread lanf0n

lanf0n added the comment:

thanks xiang, Nick,

I might misunderstood MethodType to bound method will work as class definition.

It might not good to enhance MethodType to work as class definition, same 
problem on patching method to a class as Nick explained.

--

___
Python tracker 

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



[issue29115] distutils.core.setup does not let people set 'bugtrack_url'.

2016-12-30 Thread Berker Peksag

Berker Peksag added the comment:

Marc-Andre is correct. bugtrack_url is a distribute/setuptools specific option. 
Please report your problem to them.

--
nosy: +berker.peksag
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-30 Thread Nick Coghlan

Nick Coghlan added the comment:

It depends on the scope of uniqueness we're after. `threading._counter()` 
(which is the small-integer-ID debugging counter for threading.Thread names) is 
a module global in the threading module, so an Initialize/Finalize cycle will 
reset it.

If we wanted to track "Which Initialize/Finalize cycle is this?" *as well*, it 
would make more sense to me to have that as a separate "runtime" counter, such 
that the full coordinates of the current point of execution were:

- runtime counter (How many times has Py_Initialize been called?)
- interpreter counter (Which interpreter is currently active?)
- thread name (Which thread is currently active?)

I'll also note that in the threading module, the main thread is implicitly 
thread 0 (but named as MainThread) - Thread-1 is the first thread created via 
threading.Thread. So it may make sense to use a signed numeric ID, with 0 being 
the main interpreter, 1 being the first subinterpreter, and negative IDs being 
errors.

--

___
Python tracker 

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



[issue29115] distutils.core.setup does not let people set 'bugtrack_url'.

2016-12-30 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

I believe you need to report this problem to the setuptools maintainers. The 
stdlib distutils itself never defined a setup() argument 'bugtrack_url', so 
raises a warning when seeing this argument.

--
nosy: +lemburg

___
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-30 Thread Nick Coghlan

Nick Coghlan added the comment:

Right, this isn't actually a bug, it just requires a bit more creativity to 
bind and resolve `__class__` correctly when defining the replacement method.

Here's what happens normally with zero-argument super():

>>> class A:
... def f(self):
... print(__class__)
... 
>>> A().f()

>>> A.f.__closure__
(,)
>>> inspect.getclosurevars(A.f)
ClosureVars(nonlocals={'__class__': }, globals={}, 
builtins={'print': }, unbound=set())

And here's one way of emulating the __class__ resolution part:

>>> def make_method():
... __class__ = A
... def fn(self):
... print(__class__)
... return fn
... 
>>> A.fn = make_method()
>>> A().fn()


And applying that to get zero-argument super() working in a substitute method 
gives:

>>> class B(A):
... def f(self):
... super().f()
... 
>>> B().f() # Normal super()

>>> def make_B_method():
... __class__ = B
... def fn(self):
... return super().fn()
... return fn
... 
>>> B.fn = make_B_method()
>>> B().fn()  # Emulated super()


--
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-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> What do you think about resetting the counter back to 1 in Py_Initialize?

Wouldn't this break the main property of IDs, the uniqueness?

--

___
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-30 Thread Nick Coghlan

Nick Coghlan added the comment:

+1 from me for the general idea.

One subtlety with the draft implementation is that an Initialize/Finalize cycle 
doesn't reset the counter, which:

1. Increases the chance of counter overflow (while admittedly still leaving it 
incredibly low)
2. Means you still can't readily check whether the current interpreter is the 
main interpreter (i.e. the one created automatically in Py_Initialize)

What do you think about resetting the counter back to 1 in Py_Initialize?

--

___
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-30 Thread Stefan Krah

Changes by Stefan Krah :


--
assignee:  -> skrah
resolution:  -> fixed
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



[issue29111] Strange signature for memoryview constructor

2016-12-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1e1e24629218 by Stefan Krah in branch '3.5':
Issue #29111: Fix memoryview signature.
https://hg.python.org/cpython/rev/1e1e24629218

--
nosy: +python-dev

___
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-30 Thread Ammar Askar

Changes by Ammar Askar :


Added file: http://bugs.python.org/file46092/truncate_negatives.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-30 Thread Ammar Askar

Ammar Askar added the comment:

I've attached two patches that fix this behavior, one by simply foregoing the 
fold detection for this time range on windows (the patch that I'd argue is 
simpler and more readable)

And one that truncates the passed values to local to not be negative. This one 
would have been simple but unfortunately there's the complication that there 
are two local calls and additionally, the second one cannot be truncated to 
exactly 0 because then we incorrectly detect a fold for the timestamp 0.

--
keywords: +patch
Added file: http://bugs.python.org/file46091/forego_fold_detection.patch

___
Python tracker 

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



[issue28816] Document if zipimport can respect import hooks to load custom files from zip.

2016-12-30 Thread Decorater

Decorater added the comment:

OK, Well I just tested and it sadly don't support import hooks that adds 
support for importing custom file types or file types python does know about 
with a uncommon extension inside of zip files which is somewhat sad. However if 
someone was to do something similar to py2exe's import hook allowing memory 
loading pyd and so files they could allow it to work for their import hook's 
needs.

--
keywords: +patch
Added file: http://bugs.python.org/file46090/zipimport.rst.patch

___
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-30 Thread Stefan Krah

Stefan Krah added the comment:

The patch seems to fix it. $module was a thing at some point, I don't know 
whether the semantics changed or if it was wrong in the first place.

--
keywords: +patch
Added file: http://bugs.python.org/file46089/issue29111.diff

___
Python tracker 

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



[issue29115] distutils.core.setup does not let people set 'bugtrack_url'.

2016-12-30 Thread Decorater

New submission from Decorater:

So, I could have an example setup.py which sets a bugtrack url however using 
sdist and bdist_wheel on them produces this warning:

H:\Python\Python360\lib\distutils\dist.py:261: UserWarning: Unknown 
distribution option: 'bugtrack_url'
  warnings.warn(msg)

The issue with this is wanting to set or change the bug track url's for the 
particular packages using setup.py to generate a PKG-INFO file which explicitly 
sets the value.

Currently there is no way to modify the fields online anymore since probably 
like 3~4 months ago I before was able to do it for a little while without 
having to upload a PKG-INFO file.

Example setup.py that does this:

from setuptools import setup
import re

requirements = []
try:
with open('requirements.txt') as f:
requirements = f.read().splitlines()
except Exception as ex:
with open('sasync.egg-info\requires.txt') as f:
requirements = f.read().splitlines()

version = '0.0.1'

if not version:
raise RuntimeError('version is not set')

with open('README') as f:
readme = f.read()

setup(name='examplepackage',
  author='Decorater',
  author_email='seandhun...@yahoo.com',
  url='https://github.com/AraHaan/examplepackage',
  bugtrack_url='https://github.com/AraHaan/examplepackage/issues',
  version=version,
  packages=['sasync'],
  license='MIT',
  description=('example package package demonstrating that bugtrack_url is 
not recognized by distutils.'),
  long_description=readme,
  maintainer_email='seandhun...@yahoo.com',
  download_url='https://github.com/AraHaan/examplepackage',
  include_package_data=True,
  install_requires=requirements,
  platforms='Any',
  classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: Other Audience',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: Software Development :: Libraries :: Python Modules',
  ]
)

--
components: Distutils, Library (Lib)
messages: 284323
nosy: Decorater, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: distutils.core.setup does not let people set 'bugtrack_url'.
versions: 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



[issue29061] secrets.randbelow(-1) hangs

2016-12-30 Thread Steven D'Aprano

Steven D'Aprano added the comment:

> _randbelow is a private api and it is not broken, it is just being 
> misused by the secrets module.

"Misused" seems a bit strong. Should I understand that you dislike the 
wrapper around _randbelow? The implementation was given in the PEP, and 
I don't remember any objections to it, but if you have an alternative 
implementation I'm not wedded to the idea of wrapping _randbelow.

https://www.python.org/dev/peps/pep-0506/#id81

Thanks for the patch Brendan, and thanks Raymond for applying it.

--

___
Python tracker 

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