[issue22594] Add a link to the regex module in re documentation

2017-02-22 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
versions: +Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue27788] platform module's version number doesn't match its docstring

2017-02-22 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


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



[issue29616] input() after restarting causes bug

2017-02-22 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The implementation of standard input/output in IDLE was significantly changed 
in recent years.

--

___
Python tracker 

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



[issue29553] Argparser does not display closing parentheses in nested mutex groups

2017-02-22 Thread paul j3

paul j3 added the comment:

I played around with the patch 117.  I was wrong in thinking this was another 
case of excess brackets being wrongly purged.  The fix works by adding ending ] 
that were missing the original.  And it does add a symmetry to the code.  

But it is easy to construct a set of Actions that creates further errors.  For 
the 'inserts' to work correctly the mutually exclusive Actions have to be 
defined together.  So all the actions of the nested group have to be defined 
after the non nest actions of the parent group.  An optional positional can 
also cause problems.

This whole _format_actions_usage method was not written with nested groups in 
mind.  While this patch fixes one or two cases, it isn't robust.

I also don't like the idea of enshrining group nesting in the test_argparse.py 
file.  That fact that it works as well as it does is an accident, a feature, 
not an intentional behavior.

I haven't tested PR120 yet.  Dropping the inner brackets gives a cleaner 
display.  The nested brackets of 117 are hard to read, even if they are 
correct.  

Note that in http://bugs.python.org/issue22047 I proposed blocking nested 
groups, by raising an error.

The reason why it is possible to add either kind of group to a 
_MutuallyExclusiveGroup is because it inherits the add methods from 
_ActionsContainer.  Normally those group add methods are used by ArgumentParser 
which also inherits from _ActionsContainer.

It is possible to add a MutuallyExclusiveGroup to an ArgumentGroup, and that is 
somewhat useful.  It doesn't change the usage, but does let you group that set 
of Actions in the help lines.  But this nesting is not fully developed, as 
hinted at by a commeent in the method that copies 'parents':

def _add_container_actions
# add container's mutually exclusive groups
# NOTE: if add_mutually_exclusive_group ever gains title= and
# description= then this code will need to be expanded as above

--

___
Python tracker 

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



[issue29629] rgb_to_hls in colorsys.py

2017-02-22 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

0.8334 * 360 is equivalent to 300.

--

___
Python tracker 

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



[issue29533] urllib2 works slowly with proxy on windows

2017-02-22 Thread Julia Dolgova

Changes by Julia Dolgova :


--
pull_requests: +212

___
Python tracker 

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



[issue29629] rgb_to_hls in colorsys.py

2017-02-22 Thread Madhavendra Sharma

Madhavendra Sharma added the comment:

Please check examples in en.wikipedia.org/wiki/HSL_and_HSV

I picked one of them
for R = .750, B=0.250, G=0.750 
corresponding HLS value are H= 300 = (5.0 * 60) , L =  .5, S=.5

but colorsys.rgb_to_hls(0.75 ,  0.25,  0.75) gives following output
(0.8334, 0.5, 0.5)
h*60 = 0.8334 * 60 is not equal to 300

correct out put should be (5.0, 0.5, 0.5) or if h is multiplied by 60 then 
(300, 0.5, 0.5)

Thank you.
Madhavendra Sharma

--

___
Python tracker 

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



[issue29616] input() after restarting causes bug

2017-02-22 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Characters typed before Enter are never sent the the execution process, so 
there are not even interpreted as a string, let alone a command.

Do you see exactly the following when you start IDLE?

Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit 
(AMD64)] on win32

If so, there must either be something different about your system, or you are 
doing something other than what I understand you to have done.

The 5 1/2-year-old report in not completely clear to me.  The behavior reported 
could have been affected by subsequent patches.

The only restart glitch I have noticed is that previous output very 
occasionally show up after the >>> prompt.

In any case, I cannot (intentionally) fix what I cannot see.

--

___
Python tracker 

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



[issue27788] platform module's version number doesn't match its docstring

2017-02-22 Thread Matthias Bussonnier

Changes by Matthias Bussonnier :


--
pull_requests: +211

___
Python tracker 

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



[issue29622] ast module doesn't support optional fields of Parser/Python.asdl

2017-02-22 Thread INADA Naoki

INADA Naoki added the comment:

AST type doesn't have any information about optional fields.  And I don't know 
it's worth enough to add it.
When AST is instantiated by keyword arguments, there are no check about absence 
of some fields.
I suppose we can just loosen positional arguments too.

current:

if (PyTuple_GET_SIZE(args) > 0) {
if (numfields != PyTuple_GET_SIZE(args)) {
PyErr_Format(PyExc_TypeError, "%.400s constructor takes %s"
 "%zd positional argument%s",
 Py_TYPE(self)->tp_name,
 numfields == 0 ? "" : "either 0 or ",
 numfields, numfields == 1 ? "" : "s");

will be:

if (PyTuple_GET_SIZE(args) > 0) {
if (numfields > PyTuple_GET_SIZE(args)) {
PyErr_Format(PyExc_TypeError, "%.400s constructor takes at most "
 "%zd positional argument%s",
 Py_TYPE(self)->tp_name,
 numfields, numfields == 1 ? "" : "s");

--

___
Python tracker 

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



[issue29533] urllib2 works slowly with proxy on windows

2017-02-22 Thread Julia Dolgova

Julia Dolgova added the comment:

I added variable smart_proxy_bypass into request module. If it's False then 
checking IP and FQDN of the host is skipped in proxy_bypass_registry function. 

I set the default value to False, because I think it's better when the 
behaviour of urllib corresponds to IE rather than previous versions of urllib. 
This will affect only NT-systems.

--
Added file: http://bugs.python.org/file46661/request.patch

___
Python tracker 

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



[issue29629] rgb_to_hls in colorsys.py

2017-02-22 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

All coordinates in RGB and HSV spaces are floating point numbers between 0.0 
and 1.0. In Wikipedia article h is a degree value between 0° and 360°.

Could you provide an example of rgb_to_hls() returning invalid result?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue29627] configparser.ConfigParser.read() has undocumented/unexpected behaviour when given a bytestring path.

2017-02-22 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue29628] struct objects can no longer be pickled

2017-02-22 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

As a workaround you can make Struct pickleable:

from struct import Struct
import copy, copyreg
def pickle_struct(s):
return Struct, (s.format,)

copyreg.pickle(Struct, pickle_struct)

s1 = Struct('

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



[issue29629] rgb_to_hls in colorsys.py

2017-02-22 Thread Madhavendra Sharma

Changes by Madhavendra Sharma :


--
title: rgb_to_hls to colorsys.py -> rgb_to_hls in colorsys.py

___
Python tracker 

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



[issue29629] rgb_to_hls to colorsys.py

2017-02-22 Thread Madhavendra Sharma

New submission from Madhavendra Sharma:

Calculations in rgb_to_hls at line number 67 in python version 2.7.3 for "h" 
the hue component are not correct according reference mentioned in the same 
source file "en.wikipedia.org/wiki/HSV_color_space".


code snippet:

if r == maxc:
#h = (bc-gc) #current code
h = (bc-gc)%6 # suggestion
elif g == maxc:
h = 2.0+rc-bc
else:
#h = 4.0+gc-rc #current code
h = 4.0+rc-gc # suggestion

#h = (h/6.0) % 1.0 not required 

# h = 60 *h # component should be multiplied by 60 but it depends on user

--
messages: 288410
nosy: madhavendra.sharma
priority: normal
severity: normal
status: open
title: rgb_to_hls to colorsys.py
type: behavior
versions: Python 2.7, Python 3.5

___
Python tracker 

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



[issue29355] sqlite3: remove sqlite3_stmt_readonly()

2017-02-22 Thread Berker Peksag

Berker Peksag added the comment:

> - if (!sqlite3_stmt_readonly(self->statement->st)) {
> + if (self->statement->is_dml) {

Ah, yes now I understand what do you mean! :) I agree and this is already in my 
local branch to fix issue 28518.

--

___
Python tracker 

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



[issue29549] Improve docstring for str.index

2017-02-22 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I mean that this work is useless since it will be lost when convert str.index 
to Argument Clinic. Well, even when don't use Argument Clinic, but make 
str.index() be supported by inspect.signature(), the docstring should be 
significantly rewritten.

I think there are many other easy documentation issues for practicing.

And all proposed PRs change only the docstring of str.index. They don't touch 
docstrings of str.rindex, bytes.index, bytes.rindex, bytearray.index and 
bytearray.rindex. I can't approve such changes.

--

___
Python tracker 

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



[issue29628] struct objects can no longer be pickled

2017-02-22 Thread mesheb82

mesheb82 added the comment:

Thank you.

On Wed, Feb 22, 2017 at 9:22 PM, Serhiy Storchaka 
wrote:

>
> Serhiy Storchaka added the comment:
>
> > When I run the following code on Windows/Linux for < Python 3.6, I have
> no problems.
>
> You have a problem. Did you try to use the copied object? It is a broken
> Struct object.
>
> >>> copied = copy.deepcopy(this_fails)
> >>> copied.format
> >>> copied.size
> -1
> >>> copied.pack(42)
> Traceback (most recent call last):
>   File "", line 1, in 
> struct.error: pack expected -1 items for packing (got 1)
> >>> copied.unpack(b'abcd')
> Traceback (most recent call last):
>   File "", line 1, in 
> struct.error: unpack requires a bytes object of length -1
>
> Copying Struct object never worked. Now it raises an error rather than
> silently creating a broken object.
>
> --
> nosy: +serhiy.storchaka
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue29628] struct objects can no longer be pickled

2017-02-22 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> When I run the following code on Windows/Linux for < Python 3.6, I have no 
> problems.

You have a problem. Did you try to use the copied object? It is a broken Struct 
object.

>>> copied = copy.deepcopy(this_fails)
>>> copied.format
>>> copied.size
-1
>>> copied.pack(42)
Traceback (most recent call last):
  File "", line 1, in 
struct.error: pack expected -1 items for packing (got 1)
>>> copied.unpack(b'abcd')
Traceback (most recent call last):
  File "", line 1, in 
struct.error: unpack requires a bytes object of length -1

Copying Struct object never worked. Now it raises an error rather than silently 
creating a broken object.

--
nosy: +serhiy.storchaka
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



[issue29549] Improve docstring for str.index

2017-02-22 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Please everyone.  Ease up.  This is a very simple patch.  Copy what is done in 
str.find to str.index.  It doesn't need infinite discussion and debate.  I 
assigned this to Lisa to give her practice.  It wasn't intended to have five 
developers jump in and shove it back and forth.  Let's let simple things be 
simple and not waste the time of new contributors.

--

___
Python tracker 

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



[issue29549] Improve docstring for str.index

2017-02-22 Thread Xiang Zhang

Xiang Zhang added the comment:

Lisa, could you make a PR? It could let more developers see your patch.

--
nosy: +xiang.zhang
stage: needs patch -> patch review

___
Python tracker 

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



[issue29626] Issue with spacing in argparse module while using help

2017-02-22 Thread paul j3

paul j3 added the comment:

We need to see the parser setup as well.  I've never seen a bug like this 
before.  The `usage` line suggests that you are using subparsers.

It might be better if you asked this on StackOverFlow with a repeatable code 
example.  That's a better place to get debugging help of your own code.  Come 
back here if others think this is a problem with `argparse` itself rather than 
your own setup.

--
nosy: +paul.j3

___
Python tracker 

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



[issue29549] Improve docstring for str.index

2017-02-22 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Serhiy, I'm not sure what you're referring to by "Just make docstrings in the 
style of of Argument Clinic descriptions".   For the time being, I would like 
the docstring to match that of str.find().  The point of the patch is to 
decouple the two.  

AC issues and migrations can wait.  At this point, AC adoption has been more 
disruptive that helpful in a number of cases.

--

___
Python tracker 

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



[issue29628] struct objects can no longer be pickled

2017-02-22 Thread mesheb82

New submission from mesheb82:

When I run the following code on Windows/Linux for < Python 3.6, I have no 
problems.  When I run in Python 3.6.0, I get the subsequent traceback.

I checked the release notes and only saw the following struct module note 
related to half-floats: Issue #11734

from struct import Struct
import copy
this_fails = Struct('

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



[issue29463] Add `docstring` field to AST nodes

2017-02-22 Thread INADA Naoki

INADA Naoki added the comment:

s/ #29522 / #29622 /

--

___
Python tracker 

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



[issue29463] Add `docstring` field to AST nodes

2017-02-22 Thread INADA Naoki

INADA Naoki added the comment:

OK, let's continue on #29522, and close this issue.

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

___
Python tracker 

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



[issue29569] threading.Timer class: Continue periodical execution till action returns True

2017-02-22 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Ideally, proposed API expansions should be based on a demonstrated user need. 
This API is over decade old and I don't recall a single user request for this 
functionality.  A quick scan of StackOverflow didn't turn-up any questions or 
answers on the subject.

I don't see anything intrinsically wrong with the idea, but in the absence of 
demonstrated need, it is likely to become unused cruft with it attendant burden 
on maintenance and cognitive load.

--
nosy: +rhettinger

___
Python tracker 

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



[issue29355] sqlite3: remove sqlite3_stmt_readonly()

2017-02-22 Thread Ma Lin

Ma Lin added the comment:

The "old way" is not using sqlite3_stmt_readonly().

Before 3.6.0, we only count rowcount for INSERT, UPDATE, DELETE, REPLACE:
https://hg.python.org/cpython/file/3.5/Modules/_sqlite/cursor.c#l689

These four statements can be representd by is_dml in PR 245:
https://github.com/python/cpython/pull/245/commits/cbeabf4044e9e1563d228e359b0e7952f369b42a#diff-5a6abb9997d51e693f3b24986659c857R88

So only change this line is ok, then restore the behavior before 3.6.0 exactly:

- if (!sqlite3_stmt_readonly(self->statement->st)) {
+ if (self->statement->is_dml) {
self->rowcount += (long)sqlite3_changes(self->connection->db);
} else {
self->rowcount= -1L;
}

Why it's better?
sqlite3_changes() only works for INSERT, UPDATE, DELETE. see:
https://sqlite.org/c3ref/changes.html
So using sqlite3_stmt_readonly() to determine statements is not necessary at 
all.

In addition, we can add a comment for code safe in statement.c.
+/* is_dml is used in two sites:
+1, determine statements for implicit BEGIN.
+2, determine statements for counting rowcount */
self->is_dml = (PyOS_strnicmp(p, "insert ", 7) == 0)
|| (PyOS_strnicmp(p, "update ", 7) == 0)
|| (PyOS_strnicmp(p, "delete ", 7) == 0)
|| (PyOS_strnicmp(p, "replace ", 8) == 0);

--

___
Python tracker 

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



[issue29594] implementation of __or__ in enum.auto

2017-02-22 Thread Ethan Furman

Ethan Furman added the comment:

I also think using leading underscores is a better way to signal that a 
particular value is "weird".

--

___
Python tracker 

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



[issue29594] implementation of __or__ in enum.auto

2017-02-22 Thread Ethan Furman

Ethan Furman added the comment:

@Julian: Giving flag combinations their own name can be useful.  For example, 
instead of seeing Color.GREEN|RED one can see Color.YELLOW .

@Marc: I'm not convinced this is a needed change as it doesn't seem to be a 
common method, nor one that cannot be easily implemented independently (perhaps 
as a recipe in the docs).

Are you aware of other enumerations that take this approach?

--

___
Python tracker 

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



[issue29627] configparser.ConfigParser.read() has undocumented/unexpected behaviour when given a bytestring path.

2017-02-22 Thread David Ellis

New submission from David Ellis:

Related:
https://github.com/python/cpython/pull/242
https://bugs.python.org/issue29623

In the discussion over my PR for bpo-29623 it became clear that bytestring 
paths were also unsupported and it was suggested that that should be a separate 
issue (currently the PR adds checks for both types).

There is some possible odd behaviour as when given a bytestring path the method 
attempts to open the integer file descriptors for each character in the 
bytestring. This will most likely fail silently but if it does find an actual 
file descriptor it will attempt to read and then close the file.

Example from the discussion on the PR:

>>> import os
>>> import configparser
>>> k = os.open('/home/david/develop/cpython/Lib/test/cfgparser.1', os.O_RDONLY)
>>> k
3
>>> c = configparser.ConfigParser()
>>> c.read(b'\x03') 
[3]
>>> list(c)
['DEFAULT', 'Foo Bar']
>>> os.close(k)  # File has already been closed
OSError: [Errno 9] Bad file descriptor

Currently bytestrings do work correctly when provided as part of a list.

--
components: Library (Lib)
messages: 288394
nosy: David Ellis
priority: normal
severity: normal
status: open
title: configparser.ConfigParser.read() has undocumented/unexpected behaviour 
when given a bytestring path.
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue29614] Additional implementation alternative to DictReader

2017-02-22 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I concur with Serhiy, David, and Inada

Marking this as closed.

--
nosy: +rhettinger
resolution:  -> rejected
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



[issue29616] input() after restarting causes bug

2017-02-22 Thread Juan

Juan added the comment:

I am using Windows 10 64-bit.

>> sometimes whatever you pressed in step 3 disappears,
>
> When Shell is restarted by whatever means, any pending input, whether in 
> response to '>>>' or user input(), is cancelled and
> *should* disappear and not be left to look as if it were processed.  It  
> consistently does for me.
It doesn't for me.

> > doesn't respond to commands
> 
> When a user-coded input() is active, anything typed *should* be treated as 
> text and not interpreted as a command.
Even before enters?

At the comments of 
http://inventwithpython.com/blog/2011/11/29/the-things-i-hate-about-idle-that-i-wish-someone-would-fix/
 I found someone having the same problem as me, MrValdez ()

This is a relevant part of his comment:
> ANNOYANCE: input() doesn't play well when re-running a script when the script 
> is already running.
> 
> Here's a use case. A student types this program in IDLE:
>
> --
>
> x = input("Typ a word:")
> print (x)
>
> --
>
> They run the code. In the shell window, the student would notice the 
> mispelling. Without exiting the shell window,
> they would go edit the code and then press F5.
>
> The shell would still be running the previous code instead of restarting.
>
> In some of my exercises, the students would sometimes think their code are 
> broken when in reality, they already 
> got the solution. They were just running the older instance.
>
> This becomes common enough that I ask my students to exit the shell window 
> before running their scripts.

--

___
Python tracker 

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



[issue25008] Deprecate smtpd (based on deprecated asyncore/asynchat)

2017-02-22 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

aiosmtpd is coming along nicely:

http://aiosmtpd.readthedocs.io/en/latest/

We'll soon have a 1.0 release.  Still, I don't think it's worth pulling this 
into the stdlib.  But we could silently deprecate it and point to aiosmtpd in 
the docs.

--
assignee:  -> barry
components: +Documentation -Library (Lib)
title: Deprecate smtpd (based on deprecated asyncore/asynchat): write a new 
smtp server with asyncio -> Deprecate smtpd (based on deprecated 
asyncore/asynchat)
versions: +Python 3.7 -Python 3.6

___
Python tracker 

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



[issue15657] Error in Python 3 docs for PyMethodDef

2017-02-22 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

I think this bug has been fixed.

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

___
Python tracker 

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



[issue29626] Issue with spacing in argparse module while using help

2017-02-22 Thread Falguniben Jhaveri

New submission from Falguniben Jhaveri:

When I use argparse the optional arguments with character "-p" and "-s" has 
improper spacing while using help/usage command.

Sample out put from argparse module:

usage: cli node list [-h] [-p] [-o]

Lists nodes in your current project.

optional arguments:
  -h, --help show this help message and exit
  // extra space after p
  -p , --projectid  
  -o, --org (For administrators only) Lists all the nodes in

--
components: Library (Lib)
messages: 288389
nosy: falu2010
priority: normal
severity: normal
status: open
title: Issue with spacing in argparse module while using help
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



[issue29355] sqlite3: remove sqlite3_stmt_readonly()

2017-02-22 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the report, Ma.

> We can use the old way in here, the old way is even better IMO.

What do you mean by the old way? The use of switch statement?

--
dependencies: +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



[issue29616] input() after restarting causes bug

2017-02-22 Thread Terry J. Reedy

Terry J. Reedy added the comment:

What OS are you using?

> 6. Bug.

This does not tell me what you think the bug is.

> sometimes whatever you pressed in step 3 disappears,

When Shell is restarted by whatever means, any pending input, whether in 
response to '>>>' or user input(), is cancelled and *should* disappear and not 
be left to look as if it were processed.  It consistently does for me.

> doesn't respond to commands

When a user-coded input() is active, anything typed *should* be treated as text 
and not interpreted as a command.

--

___
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

2017-02-22 Thread Berker Peksag

Changes by Berker Peksag :


--
dependencies: +sqlite3: remove sqlite3_stmt_readonly()
type:  -> enhancement
versions: +Python 3.7

___
Python tracker 

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



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

2017-02-22 Thread Berker Peksag

Changes by Berker Peksag :


--
pull_requests: +210

___
Python tracker 

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



[issue29625] colorsys.rgb_to_hsv always returns saturation as 0 (python2.7 only)

2017-02-22 Thread Will Pittman

Will Pittman added the comment:

oh, thank you very much and sorry for my negligence!

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



[issue20438] inspect: Deprecate getfullargspec?

2017-02-22 Thread Berker Peksag

Changes by Berker Peksag :


--
pull_requests: +207

___
Python tracker 

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



[issue20438] inspect: Deprecate getfullargspec?

2017-02-22 Thread Berker Peksag

Changes by Berker Peksag :


--
pull_requests: +209

___
Python tracker 

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



[issue28814] Deprecation notice on inspect.getargvalues() is incorrect

2017-02-22 Thread Berker Peksag

Changes by Berker Peksag :


--
pull_requests: +208

___
Python tracker 

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



[issue28814] Deprecation notice on inspect.getargvalues() is incorrect

2017-02-22 Thread Berker Peksag

Changes by Berker Peksag :


--
pull_requests: +206

___
Python tracker 

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



[issue29623] configparser.ConfigParser.read() does not accept Pathlib path as a single argument.

2017-02-22 Thread Berker Peksag

Changes by Berker Peksag :


--
stage:  -> patch review

___
Python tracker 

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



[issue29623] configparser.ConfigParser.read() does not accept Pathlib path as a single argument.

2017-02-22 Thread David Ellis

Changes by David Ellis :


--
pull_requests: +205

___
Python tracker 

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



[issue22549] bug in accessing bytes, inconsistent with normal strings and python 2.7

2017-02-22 Thread Marco Buttu

Changes by Marco Buttu :


--
pull_requests: +203

___
Python tracker 

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



[issue22273] abort when passing certain structs by value using ctypes

2017-02-22 Thread Eryk Sun

Eryk Sun added the comment:

Notes on fix-22273-02.diff:

In the second pass over _fields_, you can (should) use dict->length and 
dict->proto for array types instead of the _length_ and _type_ attributes. 

When reassigning stgdict->ffi_type_pointer.elements, if 
use_broken_old_ctypes_semantics is false, then you also have to allocate space 
for and copy the elements from the base class if any (i.e. if basedict && 
basedict->length > 0).

Regarding structs with bitfields and unions, we could add an stgdict flag to 
prevent passing them as arguments in the Unix X86_64 ABI -- e.g.   add a flag 
named TYPEFLAG_NONARGTYPE (0x400). ConvParam (callproc.c) and 
converters_from_argtypes (_ctypes.c) would raise an ArgumentError or TypeError 
in this case. Subclasses of structs and unions would inherit this flag value in 
StructUnionType_new.

The first pass in PyCStructUnionType_update_stgdict can set arrays_seen and 
bitfields_seen. Also, per the above suggestion, isArgType can be added. 
Moreover, since we don't have to worry about bitfields if we forbid passing 
structs with bitfields in this ABI, then MAX_ELEMENTS can be reduced to 8. For 
example:

#ifdef X86_64
#define MAX_ELEMENTS 8
isArgType = (!(stgdict->flags & TYPEFLAG_NONARGTYPE) &&
 isStruct && !bitfields_seen);
if (!isArgType) {
stgdict->flags |= TYPEFLAG_NONARGTYPE;
} else if (size <= 16 && arrays_seen) {
ffi_type *actual_types[MAX_ELEMENTS + 1];
int actual_type_index = 0;

/* second pass over _fields_ */

}

This is speculative based on how we address passing unions and structs with 
bitfields in the 64-bit Unix ABI. Raising a descriptive exception is at least 
an improvement over abruptly aborting the process.

--

___
Python tracker 

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



[issue22594] Add a link to the regex module in re documentation

2017-02-22 Thread Marco Buttu

Changes by Marco Buttu :


--
pull_requests: +204

___
Python tracker 

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



[issue29622] ast module doesn't support optional fields of Parser/Python.asdl

2017-02-22 Thread Thomas Kluyver

Changes by Thomas Kluyver :


--
nosy: +takluyver

___
Python tracker 

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



[issue29176] /tmp does not exist on Android and is used by curses.window.putwin()

2017-02-22 Thread Christian Heimes

Christian Heimes added the comment:

I think we can live with the fact some tmpfile() might write an error message 
if the system is broken. If user's tmp is not writeable, the user has more 
serious issues than a write to stdout inside curses module.

--

___
Python tracker 

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



[issue27200] make doctest in CPython has failures

2017-02-22 Thread Marco Buttu

Changes by Marco Buttu :


--
pull_requests: +202

___
Python tracker 

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



[issue28686] py.exe ignored PATH when using python3 shebang

2017-02-22 Thread Vinay Sajip

Changes by Vinay Sajip :


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue29625] colorsys.rgb_to_hsv always returns saturation as 0 (python2.7 only)

2017-02-22 Thread Mark Dickinson

Mark Dickinson added the comment:

The arguments to rgb_to_hsv are supposed to be floating-point numbers in the 
range 0.0 to 1.0. That's documented here: 
https://docs.python.org/2/library/colorsys.html

> Coordinates in all of these color spaces are floating point values. In the 
> YIQ space, the Y coordinate is between 0 and 1, but the I and Q coordinates 
> can be positive or negative. In all other spaces, the coordinates are all 
> between 0 and 1.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue29623] configparser.ConfigParser.read() does not accept Pathlib path as a single argument.

2017-02-22 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



[issue29553] Argparser does not display closing parentheses in nested mutex groups

2017-02-22 Thread paul j3

paul j3 added the comment:

http://bugs.python.org/issue22047 "argparse improperly prints mutually 
exclusive options when they are in a group"

is similar.

-

There are two issues:

- the nesting of mutually exclusive groups

- the formatting of the usage in such cases.

Both have come up in one way or other in other bug reports.

Yes, it is possible to add a group to an existing group.  But from a testing 
standpoint the effect is the same as if you put all actions into one super 
group. 

More often people try to nest ArgumentGroups in MutuallyExclusiveGroups 
thinking that would give some sort of 'any' or 'and' logic within the 'xor' 
logic.  I have explored that in 

http://bugs.python.org/issue11588.  

Defining nestable groups is relatively easy.  Writing good usage is much harder.
 
The usage formatter is brittle.  It creates a big string, strips out 'excess' 
characters (the problem here), and then splits and reassembles the string 
(leading to assertion errors if the metavars contain funny characters).

In 

http://bugs.python.org/issue11874  

I submitted a patch that substantially rewrites the usage formatter.  The idea 
was to keep the action strings separate until the last moment.  While I haven't 
tested it with the current problem, I did use it in my nested-groups coding.

While I'm not opposed to patching the usage formatting in bits and pieces, we 
should do so while fully aware of the big picture.  Little patches tend to make 
brittle code even more brittle.

--

___
Python tracker 

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



[issue29625] colorsys.rgb_to_hsv always returns saturation as 0 (python2.7 only)

2017-02-22 Thread Will Pittman

Changes by Will Pittman :


--
title: colorsys.rgb_to_hsv  always returns saturation as 0 (python2.7.13 only) 
-> colorsys.rgb_to_hsv  always returns saturation as 0 (python2.7 only)

___
Python tracker 

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



[issue28129] assertion failures in ctypes

2017-02-22 Thread Vinay Sajip

Changes by Vinay Sajip :


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue29625] colorsys.rgb_to_hsv always returns saturation as 0 (python2.7.13 only)

2017-02-22 Thread Will Pittman

Will Pittman added the comment:

The bug appears to be caused by the difference in division
symbols between python3 vs python2.

The issue appears to be resolved if you add the following line to the
`/usr/lib/python2.7.13/colorsys.py` module (or if all arguments are converted 
to floats).

from __future__ import division

I noticed that this bug persists all the back to at least python2.7.10

--

___
Python tracker 

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



[issue29625] colorsys.rgb_to_hsv always returns saturation as 0 (python2.7.13 only)

2017-02-22 Thread Will Pittman

New submission from Will Pittman:

colorsys.rgb_to_hsv appears to be broken on python2.7.13 (on archlinux).
Saturation is always reported as 0.

ex:

import colorsys
rgb_to_hsv( 127, 116, 18 )
>>> (0.1, 0, 127)

--
messages: 288380
nosy: Will Pittman
priority: normal
severity: normal
status: open
title: colorsys.rgb_to_hsv  always returns saturation as 0 (python2.7.13 only)
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



[issue29624] Python 3.5.3 x86 web installer cannot install launcher

2017-02-22 Thread Steve Dower

New submission from Steve Dower:

For some reason, the install bootstrapper for 3.5.3 x86 embedded the wrong hash 
value for launcher.msi. As a result, it will fail to download the file and 
install will be aborted.

The workaround is to deselect the launcher from being installed, and use the 
64-bit installer to install the launcher. Or alternatively, install Python 3.6 
to get the later version of the installer, which will then automatically skip 
it for the 3.5 installer.

Python 3.6 is unaffected, so this may just have been a build glitch, but it 
needs investigation and testing so it doesn't happen again. (Adding a /layout 
test after uploading is an easy way to test this.)

--
assignee: steve.dower
components: Windows
messages: 288379
nosy: paul.moore, steve.dower, tim.golden, zach.ware
priority: critical
severity: normal
stage: test needed
status: open
title: Python 3.5.3 x86 web installer cannot install launcher
type: crash
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



[issue29623] configparser.ConfigParser.read() does not accept Pathlib path as a single argument.

2017-02-22 Thread David Ellis

New submission from David Ellis:

Trying to use configparser.ConfigParser.read on a pathlib object results in a 
TypeError. If supplied in a list it works as expected.

Repro:
>>> import pathlib, configparser
>>> configparser.ConfigParser().read(pathlib.Path('some.ini'))

TypeError: 'PosixPath' object is not iterable

The issue appears to be line 690 which checks for str before attempting to 
iterate and doesn't check for os.PathLike (or bytes?).

This was actually mentioned as an example where pathlib did not work here: 
https://bugs.python.org/issue22570

--
components: Library (Lib)
messages: 288378
nosy: David Ellis
priority: normal
severity: normal
status: open
title: configparser.ConfigParser.read() does not accept Pathlib path as a 
single argument.
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



[issue29603] More informative Queue class: new method that returns number of unfinished tasks

2017-02-22 Thread slytomcat

slytomcat added the comment:

I've closed pull request on GitHub.

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



[issue29603] More informative Queue class: new method that returns number of unfinished tasks

2017-02-22 Thread slytomcat

slytomcat added the comment:

I can't fully agree with this:
>Queue objects are primarily about managing a queue of inputs.  
>Monitoring and managing consumers is another (mostly orthogonal) realm.

Monitoring of consumers is already added via task_done() and join() methods. At 
least this two methods allows to understand that all consumers are in idle 
state.
The unfinished() - is just functional extension to this existing functionality.

>For other users, the new method is problematic because it is distracting
>and prone to misuse (potentially out-of-date upon return and potentially 
>meaningless if task_done isn't being used).  I believe the new method 
>will cause more problems than it fixes.

This sounds reasonable because I also understand that this method is not usable 
in all cases as in most cases task_done is not used.

Probably my idea for method unfinished is really not so good...

Actually I've manage to find unpublished Queue.unfinished_tasks variable just 
in several minutes when I tried to find solution for threaded PoolExecutor. 
Hope that any curious developer can find it too.

I don't mind if you close this CR. 

Thanks for pleasant discussion.

--

___
Python tracker 

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



[issue29463] Add `docstring` field to AST nodes

2017-02-22 Thread Matthias Bussonnier

Matthias Bussonnier added the comment:

thank you for your work on the AST, I know many developers are looking forward 
to improvement and stabilisation with the hope of having it stable (and 
documented) in the stdlib at some point. 

The recent change in PR 46 now change (at least) the constructor of 
`ast.Module` to take a second mandatory parameter (the docstring). 

I know the ast is autogenerated and "use at your own risk". But IPython for 
example, use `mod = ast.Module([nodes])`, with the second mandatory parameter 
added to Module that make it incompatible with current Python 3.7. 
Well it's long until it's released, and we can patch things, but I'm sure we 
are not the only one in this case, and we'd like older version of IPython to 
still be compatible with Python 3.7, so if  `Module()`'s second parameter (the 
docstring) could be optional, that would be great. 

I would be happy if it raise a deprecation warning that it will be required in 
the future.

I'm of course speaking about `Module` because that's the first error I 
encountered, but I'm guessing it applies to other changed AST nodes. 

Thanks.

--
nosy: +mbussonn

___
Python tracker 

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



[issue29622] ast module doesn't support optional fields of Parser/Python.asdl

2017-02-22 Thread Matthias Bussonnier

Matthias Bussonnier added the comment:

Duplicating my comment of 29463 who was in a race condition with this issue:


thank you for your work on the AST, I know many developers are looking forward 
to improvement and stabilisation with the hope of having it stable (and 
documented) in the stdlib at some point. 

The recent change in PR 46 now change (at least) the constructor of 
`ast.Module` to take a second mandatory parameter (the docstring). 

I know the ast is autogenerated and "use at your own risk". But IPython for 
example, use `mod = ast.Module([nodes])`, with the second mandatory parameter 
added to Module that make it incompatible with current Python 3.7. 
Well it's long until it's released, and we can patch things, but I'm sure we 
are not the only one in this case, and we'd like older version of IPython to 
still be compatible with Python 3.7, so if  `Module()`'s second parameter (the 
docstring) could be optional, that would be great. 

I would be happy if it raise a deprecation warning that it will be required in 
the future.

I'm of course speaking about `Module` because that's the first error I 
encountered, but I'm guessing it applies to other changed AST nodes. 

Thanks.
---

--
nosy: +mbussonn

___
Python tracker 

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



[issue29463] Add `docstring` field to AST nodes

2017-02-22 Thread STINNER Victor

STINNER Victor added the comment:

This issue broke the ast API. Copy of the following comment on the PR:
https://github.com/python/cpython/pull/46#issuecomment-281721296
---
Carreau: Thanks for this ! Improvement to the AST are welcome !

Would it have been possible to make the docstring optional ? (It's already 
breaking things, like IPython).

Should I comment on upstream bpo ?
---

I created the issue #29622 to fix this.

--

___
Python tracker 

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



[issue29622] ast module doesn't support optional fields of Parser/Python.asdl

2017-02-22 Thread STINNER Victor

New submission from STINNER Victor:

The _ast.AST constructor requires a tuple with the same number of items than 
the fields list.

Example with Raise:

ASDL: Raise(expr? exc, expr? cause)

>>> import _ast
>>> _ast.Raise()
<_ast.Raise object at 0x7fc2ca7dee90>
>>> _ast.Raise(1)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: Raise constructor takes either 0 or 2 positional arguments
>>> _ast.Raise(1, 2)
<_ast.Raise object at 0x7fc2ca7def60>

The cause field is optional in the ASDL, but required in the _ast module.

A tradeoff would be to add the minimum and maximum number of fields to _ast.AST.

This issue should prevent API breakage caused by the new docstring attribute 
added by issue #29463.

--
messages: 288372
nosy: haypo, inada.naoki
priority: normal
severity: normal
status: open
title: ast module doesn't support optional fields of Parser/Python.asdl
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue29621] telnetlib.Telnet.write gives confusing error message when a string is passed in

2017-02-22 Thread John Hagen

New submission from John Hagen:

I was recently helping someone learn Python 3 from Python 2 and they were 
confused by error resulting from the following easy-to-make mistake:

import telnetlib

tn = telnetlib.Telnet('localhost')
tn.write('hello')

Traceback (most recent call last):
  File "/Users/user/PycharmProjects/python-test/main.py", line 4, in 
tn.write('hello')
  File 
"/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/telnetlib.py", 
line 287, in write
if IAC in buffer:
TypeError: 'in ' requires string as left operand, not bytes

What is confusing is that the solution is to pass in `bytes`, not a `str`, but 
the place where this manifests is in an `in` operator with the first argument 
as a `bytes` (telnetlib.IAC).

Perhaps a simple isinstance(buffer, bytes) could be used to throw a `TypeError` 
or something a bit more helpful.

It also doesn't help that for some reason Googling "python telnet" only seems 
to bring up the Python 2 docs link, rather than Python 3 or both.

--
components: Library (Lib)
messages: 288371
nosy: John Hagen
priority: normal
severity: normal
status: open
title: telnetlib.Telnet.write gives confusing error message when a string is 
passed in
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue29620] unittest.TestCase.assertWarns raises RuntimeEror if sys.modules changes size

2017-02-22 Thread kernc

New submission from kernc:

If any of the objects in sys.modules is a module-like object that performs some 
additional imports in its __getattribute__ (as appropriate) handler, the 
following simple unit test test case:

import unittest
import warnings

... # Ensure one of the imported modules is a module-like object as above

class Case(unittest.TestCase):
def test_assertWarns(self):
with self.assertWarns(UserWarning):
warnings.warn('Some warning')

fails with:

==
ERROR: test_assertWarns (example.Case)
--
Traceback (most recent call last):
  File "/tmp/example.py", line 9, in test_assertWarns
with self.assertWarns(UserWarning):
  File "/usr/lib/python3.4/unittest/case.py", line 205, in __enter__
for v in sys.modules.values():
RuntimeError: dictionary changed size during iteration
--

The problem is in the iteration over sys.modules in 
unittest.case._AssertWarnsContext.__enter__() and accessing every module's 
__warningregistry__ attribute. On this access, the module-like objects may 
perform arbitrary actions including importing of further modules which extends 
sys.modules.

https://github.com/python/cpython/blob/16ea19fc6653ee4ec1be7cd0206073962119ac08/Lib/unittest/case.py#L226-L227

The simple proposed fix with no foreseen side-effects is to wrap 
sys.modules.values() call as a tuple().

--
components: Library (Lib)
messages: 288370
nosy: kernc
priority: normal
severity: normal
status: open
title: unittest.TestCase.assertWarns raises RuntimeEror if sys.modules changes 
size
type: behavior
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



[issue29614] Additional implementation alternative to DictReader

2017-02-22 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Or use DictReader with an explicit fieldnames argument.

--

___
Python tracker 

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



[issue29614] Additional implementation alternative to DictReader

2017-02-22 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I'm with Inada and David. This use case looks very specific. If you need to 
handle a CSV file with duplicated header, you can use the regular reader or 
implement your own specialised reader.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue29614] Additional implementation alternative to DictReader

2017-02-22 Thread R. David Murray

R. David Murray added the comment:

My opinion stated in that issue is still the same: I don't think this is a bug. 
 I don't think automatic handling of fieldnames when no other dictionary 
features are retained is worth the complication to the API.  So I'm still -1.  
We'll see what other people think.

--

___
Python tracker 

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



[issue29614] Additional implementation alternative to DictReader

2017-02-22 Thread foxfluff

foxfluff added the comment:

David:
You are correct that the goal is to handle CSVs with duplicate headers, and 
that the main intention is to have some of the behavior of DictReader without 
the destruction of data (such as the auto population of field names as you 
stated).

It is not the intention of this to change the behavior of DictReader, as stated 
in issue 17537. It is instead covering a problem that was discussed later in 
the thread and would offer an alternative solution with non destructive 
behavior to DictReader while maintaining backwards compatibility.

--

___
Python tracker 

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



[issue28911] Clarify the behaviour of assert_called_once_with

2017-02-22 Thread STINNER Victor

STINNER Victor added the comment:

Can you please try to write a pull request?
https://docs.python.org/devguide/pullrequest.html

--

___
Python tracker 

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



[issue29546] A more helpful ImportError message

2017-02-22 Thread Barry A. Warsaw

Changes by Barry A. Warsaw :


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



[issue29614] Additional implementation alternative to DictReader

2017-02-22 Thread R. David Murray

R. David Murray added the comment:

Inada: I believe the goal is to be able to handle CSV files that have columns 
with duplicate names.  However, in that case one could just use the regular 
reader class.  The only advantage TableReader gives over the regular reader 
that I can see is that it automatically reads the header line and sets 
fieldnames.  I'm not sure that is enough motivation for introducing a whole new 
class.

It also doesn't address the issue the OP mentions, that columns are overwritten 
silently by DictReader.  However, that is a characteristic of dicts in Python 
in general, so I'm not sure I even see that as a bug.

Overall, I'm -1 on this proposal.

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



[issue29616] input() after restarting causes bug

2017-02-22 Thread Juan

Juan added the comment:

*doesn't respond to commands. I mean something similar to (not equal) 
"while(1): pass")

--

___
Python tracker 

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



[issue29616] input() after restarting causes bug

2017-02-22 Thread Juan

Juan added the comment:

What I meant was:
1. Open a file whose content is "input()" with IDLE
2. F5
3. Type something but without pressing Enter.
4. Come back to the script (with input() still responding to keystrokes on the 
input line)
5. F5
6. Bug. (Results vary even on the same machine by closing and opening Python 
again, sometimes whatever you pressed in step 3 disappears, sometimes it just 
takes input, doesn't respond to commands similar (not equal) to "while(1): 
pass")

--
status: pending -> open

___
Python tracker 

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



[issue29176] /tmp does not exist on Android and is used by curses.window.putwin()

2017-02-22 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The manpage of tmpfile contains the note:

   POSIX.1-2001 specifies: an error message may be written to stdout if the 
stream cannot be opened.

Did you tested tmpfile() with readonly temporary files directory or overfull 
file system?

--

___
Python tracker 

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



[issue28810] Document bytecode changes in 3.6

2017-02-22 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your patches Ivan. Feel free to rewrite my patch, I'm sure it 
uses poor English.

--
dependencies: +Document BUILD_*_UNPACK opcodes

___
Python tracker 

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



[issue28810] Document bytecode changes in 3.6

2017-02-22 Thread Ivan Levkivskyi

Changes by Ivan Levkivskyi :


--
pull_requests: +201

___
Python tracker 

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



[issue29603] More informative Queue class: new method that returns number of unfinished tasks

2017-02-22 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> And even when Queue.unfinished gives wrong (outdated) information, 
> it can lead to creation one new thread that is not really required 
> at the moment. That is not a big mistake, I suppose (comparing to
> creation all N threads during placing first N tasks in queue 
> without considering the volume of concurrent tasks).

IMO, this isn't worth expanding the Queue API.  The thread pool concept 
explicitly allows up to poolsize threads and occasionally having one extra 
thread within the allowed poolsize isn't important.   Also, it is unclear why a 
new thread is being launched if there in nothing in the work queue (unfinished 
tasks is only interesting when qsize==0).

For other users, the new method is problematic because it is distracting and 
prone to misuse (potentially out-of-date upon return and potentially 
meaningless if task_done isn't being used).  I believe the new method will 
cause more problems than it fixes.

Also, I really don't like the mission creep.  Queue objects are primarily about 
managing a queue of inputs.  Monitoring and managing consumers is another 
(mostly orthogonal) realm.

--

___
Python tracker 

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



[issue29553] Argparser does not display closing parentheses in nested mutex groups

2017-02-22 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +paul.j3

___
Python tracker 

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



[issue26213] Document BUILD_*_UNPACK opcodes

2017-02-22 Thread Ivan Levkivskyi

Changes by Ivan Levkivskyi :


--
pull_requests: +200

___
Python tracker 

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



[issue29619] st_ino (unsigned long long) is casted to long long in posixmodule.c:_pystat_fromstructstat

2017-02-22 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +xiang.zhang
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



[issue28911] Clarify the behaviour of assert_called_once_with

2017-02-22 Thread Arne de Laat

Arne de Laat added the comment:

*ping*
Is this patch acceptable as is?

Perhaps a new issue can be made for a method to check at most one call with a 
specific signature i.e. `assert_one_call_with`.

--

___
Python tracker 

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



[issue29619] st_ino (unsigned long long) is casted to long long in posixmodule.c:_pystat_fromstructstat

2017-02-22 Thread Mba

Changes by Mba :


--
components:  -Library (Lib)

___
Python tracker 

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



[issue29619] st_ino (unsigned long long) is casted to long long in posixmodule.c:_pystat_fromstructstat

2017-02-22 Thread Mba

New submission from Mba:

ino_t is of type 'unsigned long' or 'unsigned long long'. Casting it to signed 
type means that negative values are incorrectly returned for large inodes.

--
components: Library (Lib)
messages: 288355
nosy: mba
priority: normal
severity: normal
status: open
title: st_ino (unsigned long long) is casted to long long in 
posixmodule.c:_pystat_fromstructstat
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue29549] Improve docstring for str.index

2017-02-22 Thread Sanyam Khurana

Sanyam Khurana added the comment:

Mariatta, I apologize for this. I completely missed to see that this was 
already assigned to someone else.

I've withdrawn my PR.

Thanks.

--
nosy: +CuriousLearner

___
Python tracker 

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



[issue29549] Improve docstring for str.index

2017-02-22 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

CuriousLearner,

I see that you have PRs against this issue.
The issue is currently assigned to Lisa.
I respectfully request that you choose a different issue to work on and to 
withdraw your pull request.

Please choose an issue that is not currently assigned to anyone. If an issue is 
assigned, please ask first before working on it. 

Thank you.

--
nosy: +Mariatta

___
Python tracker 

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



[issue29176] /tmp does not exist on Android and is used by curses.window.putwin()

2017-02-22 Thread STINNER Victor

STINNER Victor added the comment:

I created https://github.com/python/cpython/pull/237 using tmpfile(). The patch 
is simpler than my previous PR using Python tempfile.

Oh... I didn't see that Christian wrote almost the same change 20 min before me 
:-D

--

___
Python tracker 

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



[issue29176] /tmp does not exist on Android and is used by curses.window.putwin()

2017-02-22 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +198

___
Python tracker 

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



[issue29176] /tmp does not exist on Android and is used by curses.window.putwin()

2017-02-22 Thread Christian Heimes

Christian Heimes added the comment:

Thanks Chi Hsuan Yen,

I have created a new PR that replaces mkstemp() with tmpfile().

--

___
Python tracker 

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



[issue29376] threading._DummyThread.__repr__ raises AssertionError

2017-02-22 Thread Xiang Zhang

Changes by Xiang Zhang :


--
pull_requests: +197

___
Python tracker 

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



[issue29176] /tmp does not exist on Android and is used by curses.window.putwin()

2017-02-22 Thread Christian Heimes

Changes by Christian Heimes :


--
pull_requests: +196

___
Python tracker 

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



[issue29598] Write unit tests for pdb module

2017-02-22 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +inada.naoki

___
Python tracker 

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



[issue29598] Write unit tests for pdb module

2017-02-22 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It would be better to move all tests for internal functions in separate 
TestCase class. It should be clear that this is testing of implementation 
details and we are free to change tests when change the implementation.

There are some tests for find_function(). They should be moved too. Note that 
there is a bug in find_function() (it opens a file with default encoding).

Tests for internal functions don't free us from testing the same functionality 
as a part of high level functions.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



  1   2   >