[issue28293] Don't completely dump the regex cache when full

2016-09-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Perhaps:  _cache.pop(next(iter(_cache)))

The for-loop version indirect about what it is trying to do and relies on an 
obscure quirk of exactly when it is an error to mutate while iterating.

I do like that the side-effect of the compact dict is that is lets us choose 
the oldest entry to evict.

--

___
Python tracker 

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



[issue28293] Don't completely dump the regex cache when full

2016-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Nice catch! Here is a patch that deletes the first key.

--
stage: commit review -> patch review
Added file: http://bugs.python.org/file44853/re_cache_del_first.patch

___
Python tracker 

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



[issue28292] Make Calendar.itermonthdates() behave consistently in edge cases

2016-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Possible solutions (in any case the documentation needs changes):

1. Raise OverflowError at both ends (revert issue15421patch). The method 
becomes unusable for two extreme months.

2. Yield an incomplete week at both ends (apply the patch from issue26650). 
This can cause silent producing incorrect result in third-party programs.

3. Yield None for unrepresentable dates. This is more useful than raising 
OverflowError, and noisily fails, but third-party code should be changed to 
support extreme cases.

4. Yield dummy date instance for unrepresentable dates (apply the patch from 
issue28253). If we are lucky, the third-party code will just work, without any 
changes. If we are not lucky, this makes debugging harder.

5. Make datetime.date supporting a date outside current limits. This is a can 
of worms (numbering years B.D., output and parsing dates with negative and more 
than 4-digit years).

Examples of the usage of itermonthdates():

https://github.com/sunlightlabs/django-locksmith/blob/master/locksmith/hub/dataviews.py
https://github.com/quandyfactory/Quandy/blob/master/quandy.py
https://github.com/takanory/plone.app.event/blob/master/plone/app/event/portlets/portlet_calendar.py
https://github.com/gerow/gnome-shell-google-calendar/blob/master/gnome-shell-google-calendar.py
https://bitbucket.org/benallard/msgboard/src/1c08fa3ba040f8151d0e28130b01b30e0595e448/msgboard/controller.py?at=default

--

___
Python tracker 

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



[issue28293] Don't completely dump the regex cache when full

2016-09-27 Thread Xiang Zhang

Xiang Zhang added the comment:

But with the compact dict implementation, popitem is not going to evict an 
arbitrary entry but always the last one. Will this cause two interchangeably 
used regexes always need to recompile?

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue28293] Don't completely dump the regex cache when full

2016-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM.

--
assignee: serhiy.storchaka -> rhettinger
stage: patch review -> commit review

___
Python tracker 

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



[issue28289] ImportError.__init__ doesn't reset not specified exception attributes

2016-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thanks Brett.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions:  -Python 3.5, Python 3.6

___
Python tracker 

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



[issue28293] Don't completely dump the regex cache when full

2016-09-27 Thread Raymond Hettinger

New submission from Raymond Hettinger:

When the regex cache gets filled, it is cleared in its entirety.  Instead, it 
only needs to evict one arbitrary entry.  This will save the us from having to 
rebuild and recache frequently used regexes.

--
assignee: serhiy.storchaka
components: Library (Lib)
files: re_cache_pop.diff
keywords: patch
messages: 277580
nosy: rhettinger, serhiy.storchaka
priority: low
severity: normal
stage: patch review
status: open
title: Don't completely dump the regex cache when full
type: performance
versions: Python 3.6, Python 3.7
Added file: http://bugs.python.org/file44852/re_cache_pop.diff

___
Python tracker 

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



[issue28288] Expose environment variable for Py_Py3kWarningFlag

2016-09-27 Thread Roy Williams

Roy Williams added the comment:

@Brett @Berker In a similar vein, it'd be great to expose the `-b` flag in 
Python 3 in a similar manner to test for invalid byte comparisons.

--

___
Python tracker 

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



[issue26072] pdb fails to access variables closed over

2016-09-27 Thread Chun-Yu Tseng

Chun-Yu Tseng added the comment:

What Antony Lee mentioned are two different cases. 

The former is what PDB should behave because it is not reasonable to inspect a 
variable does not exist in the current frame. If you want to do so, you have to 
reference the variable `x` as a closure inside inner function `g` in your 
source code before running PDB.

The latter is same as what Jesús Gómez confirmed. It's a problem about creating 
correct closures in an interaction prompt of PDB. It can be found in almost 
every versions of Python. The following are several forms of the problem:


# (1) raise exception 

  1  def f():
  2  x = 2
  3  ->import pdb; pdb.set_trace();
(Pdb) (lambda: x)()
*** NameError: name 'x' is not defined


# (2) no exception, but get the wrong value

  1  x = 100
  2  def f():
  3  x = 2
  4  ->import pdb; pdb.set_trace();
  5  f()
(Pdb) x
2
(Pdb) (lambda: x)()
100


# (3) similar to (1), but this one usually makes me upset if I forget the cause 
of the problem

(Pdb) ll
  1  def f():
  2  ->import pdb; pdb.set_trace();
(Pdb) x = 5
(Pdb) [i for i in range(10) if (i % x) == 0]
*** NameError: name 'x' is not defined
(Pdb) x
5


It's easy to alleviate the problem by using `interact` command to start an 
interactive interpreter.

  1  def f():
  2  ->import pdb; pdb.set_trace();
(Pdb) x = 5
(Pdb) interact
*interactive*
>>> [i for i in range(10) if (i % x) == 0]
[0, 5]

Now the behavior looks right.

However, the problem still exists for those PDB users don't know how to pass 
it, and it's quite inconvenient to start an interactive interpreter every time. 
Maybe it's worth to keep the behavior of PDB consistent and expectable just 
like the behavior inside interactive interpreter.

I will try to send a patch to solve the problem in these days. Please stop me 
if it's inappropriate.

--
nosy: +Chun-Yu Tseng
versions: +Python 2.7, Python 3.3, Python 3.4, Python 3.7

___
Python tracker 

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



[issue28292] Make Calendar.itermonthdates() behave consistently in edge cases

2016-09-27 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
dependencies: +calendar.prcal() output has a problem, calendar: 
OverflowErrors for year == 1 and firstweekday > 0

___
Python tracker 

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



[issue26650] calendar: OverflowErrors for year == 1 and firstweekday > 0

2016-09-27 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> Make Calendar.itermonthdates() behave consistently in edge cases

___
Python tracker 

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



[issue28253] calendar.prcal(9999) output has a problem

2016-09-27 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
resolution:  -> fixed
stage: commit review -> resolved
status: open -> closed
superseder:  -> Make Calendar.itermonthdates() behave consistently in edge cases

___
Python tracker 

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



[issue28292] Make Calendar.itermonthdates() behave consistently in edge cases

2016-09-27 Thread Alexander Belopolsky

New submission from Alexander Belopolsky:

The Calendar.itermonthdates() method is defined as follows:

"Return an iterator for one month. The iterator will yield datetime.date values 
and will always iterate through complete weeks, so it will yield dates outside 
the specified month."

However, for the two months at the extremes of datetime.date range, 0001-01 and 
-12, the dates outside the specified month may not be representable as 
datetime.date instances.

The current implementation is inconsistent: itermonthdates(1, 1) may raise an 
OverflowError (see #26650), while itermonthdates(, 12) may yield an 
incomplete week (see #28253.)

This issue supersedes #26650 and #28253.

--
assignee: belopolsky
messages: 277577
nosy: belopolsky, jiangping.li, rhettinger, serhiy.storchaka, xiang.zhang
priority: normal
severity: normal
stage: test needed
status: open
title: Make Calendar.itermonthdates() behave consistently in edge cases
type: behavior
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



[issue27873] multiprocessing.pool.Pool.map should take more than one iterable

2016-09-27 Thread naught101

naught101 added the comment:

Here you go.

--
keywords: +patch
Added file: http://bugs.python.org/file44851/mp.map.starmap.patch

___
Python tracker 

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



[issue28253] calendar.prcal(9999) output has a problem

2016-09-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f2aff898f7c8 by Alexander Belopolsky in branch '2.7':
Issue #28253: Fixed calendar functions for extreme months: 0001-01 and -12.
https://hg.python.org/cpython/rev/f2aff898f7c8

--

___
Python tracker 

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



[issue27873] multiprocessing.pool.Pool.map should take more than one iterable

2016-09-27 Thread naught101

naught101 added the comment:

OK, one question, is Pool.map preferable to Pool.starmap in any particular 
cases?

--

___
Python tracker 

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



[issue27873] multiprocessing.pool.Pool.map should take more than one iterable

2016-09-27 Thread Berker Peksag

Berker Peksag added the comment:

> What is the process? hg clone cpython, and make a patch from that and post it 
> here?

Yes, it's exactly what you just described :) See 
https://docs.python.org/devguide/index.html for details.

> Or is there some pull-request style process available?

Not yet, but we will move to GitHub soon.

--

___
Python tracker 

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



[issue27873] multiprocessing.pool.Pool.map should take more than one iterable

2016-09-27 Thread naught101

naught101 added the comment:

Happy to. What is the process? hg clone cpython, and make a patch from that and 
post it here? Or is there some pull-request style process available?

--

___
Python tracker 

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



[issue23155] unittest: object has no attribute '_removed_tests'

2016-09-27 Thread Berker Peksag

Berker Peksag added the comment:

The culprit is the ``test_suite='nose.collector'`` line here. It looks like 
this has already been fixed in nose: 
https://github.com/nose-devs/nose/issues/759

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



[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-09-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> I don't see any problem with switching the lookup order now,
> and I agree that should be less confusing,

Thanks Nick.  I concur as well and will apply this.

Would it be reasonable to apply this to 3.6?  IMO, it isn't a new feature, it 
is more of a usability bug due to an oversight.

--
nosy: +ned.deily

___
Python tracker 

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



[issue28254] Add C API for gc.enable, gc.disable, and gc.isenabled

2016-09-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

>  I don't have a burning desire to get this in, 
> I just thought it would be a nice to have.

In that case, I think we should decline.

--
resolution:  -> rejected
status: open -> closed

___
Python tracker 

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



[issue26869] unittest longMessage docs

2016-09-27 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +berker.peksag
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



[issue27470] -3 commandline option documented differently via man

2016-09-27 Thread Berker Peksag

Changes by Berker Peksag :


--
keywords: +easy
nosy: +berker.peksag
stage:  -> needs patch
type:  -> behavior

___
Python tracker 

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



[issue28253] calendar.prcal(9999) output has a problem

2016-09-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7efba48299e9 by Alexander Belopolsky in branch 'default':
Issue #28253: Added a NEWS entry.
https://hg.python.org/cpython/rev/7efba48299e9

New changeset 55f11196c949 by Alexander Belopolsky in branch '3.5':
Issue #28253: Added a NEWS entry.
https://hg.python.org/cpython/rev/55f11196c949

New changeset 1f1a085f533f by Alexander Belopolsky in branch '3.6':
Issue #28253: Added a NEWS entry.
https://hg.python.org/cpython/rev/1f1a085f533f

--

___
Python tracker 

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



[issue11501] distutils.archive_util should handle absence of zlib module

2016-09-27 Thread Berker Peksag

Changes by Berker Peksag :


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

___
Python tracker 

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



[issue28253] calendar.prcal(9999) output has a problem

2016-09-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c439bce36bf2 by Alexander Belopolsky in branch '3.5':
Issue #28253: Fixed calendar functions for extreme months: 0001-01 and -12.
https://hg.python.org/cpython/rev/c439bce36bf2

New changeset cd384c4b441a by Alexander Belopolsky in branch '3.6':
Issue #28253: Fixed calendar functions for extreme months: 0001-01 and -12.
https://hg.python.org/cpython/rev/cd384c4b441a

New changeset bc285a9ecc58 by Alexander Belopolsky in branch 'default':
Issue #28253: Fixed calendar functions for extreme months: 0001-01 and -12.
https://hg.python.org/cpython/rev/bc285a9ecc58

--
nosy: +python-dev

___
Python tracker 

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



[issue28291] urllib/urllib2 AbstractDigestAuthHandler locked to retried count of 5

2016-09-27 Thread secynic

Changes by secynic :


--
keywords: +patch
versions:  -Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file44850/issue28291.patch

___
Python tracker 

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



[issue28210] argparse with subcommands difference in python 2.7 / 3.5

2016-09-27 Thread paul j3

paul j3 added the comment:

Yes there was/is a bug that made subparsers optional.

http://bugs.python.org/issue9253

--
nosy: +paul.j3

___
Python tracker 

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



[issue28219] Is order of argparse --help output officially defined?

2016-09-27 Thread paul j3

paul j3 added the comment:

The display of the Action help lines is determined by the parser.format_help 
function

https://docs.python.org/3/library/argparse.html#printing-help

This function creates a Formatter, and then loads it with a 'stack' of 
sections.  Sections are displayed in that order:

# usage (with self._actions)
# description
# groups

for action_group in self._action_groups:
formatter.start_section(action_group.title)
formatter.add_text(action_group.description)
formatter.add_arguments(action_group._group_actions)
formatter.end_section()

parser._actions is the list of Actions (arguments) in the order in which they 
were created.  

Usage displays them, first the optionals, then the positionals.  Some 
Stackoverflow posters have asked about changing that order.  That requires 
customizing the usage formatter method.

Help is displayed by group, and with in that by creation order.  There are 2 
default groups, positionals and optionals.  User defined groups follow.  
https://docs.python.org/3/library/argparse.html#argument-groups

Probably the simplest way to write help lines in a different order is to write 
a custom parser.format_help method.  

Subclassing HelpFormatter is the 'accepted' way of customizing the help.  The 
provided subclasses work by modifying just one or two methods.  But given how a 
formatter works it is much easier to change the order while 'loading' the 
formatter rather than after it has been created.

I don't see the point to etching this behavior into the documentation. It's the 
default behavior, and relatively obvious from a few examples.  If we were to 
add some sort of customization then we'd need to elaborate.  This documentation 
is more of a how-to document than a formal description of the module.  This is 
just one of the many details that are determined by the code rather the 
documentation.  

But feel free to suggest a formal change to the documentation.

--
nosy: +paul.j3

___
Python tracker 

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



[issue28288] Expose environment variable for Py_Py3kWarningFlag

2016-09-27 Thread Berker Peksag

Berker Peksag added the comment:

+1 from me. This would help people to port their projects to Python 3.

--
nosy: +berker.peksag

___
Python tracker 

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



[issue27322] test_compile_path fails when python has been installed

2016-09-27 Thread Berker Peksag

Berker Peksag added the comment:

Here's an updated patch.

--
Added file: http://bugs.python.org/file44849/issue27322_v3.diff

___
Python tracker 

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



[issue28288] Expose environment variable for Py_Py3kWarningFlag

2016-09-27 Thread Brett Cannon

Brett Cannon added the comment:

The idea seems reasonable to me. I would think this would fall under the -3 
exemption if others agree this is reasonable to implement.

--
nosy: +brett.cannon

___
Python tracker 

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



[issue28288] Expose environment variable for Py_Py3kWarningFlag

2016-09-27 Thread Brett Cannon

Changes by Brett Cannon :


--
type: behavior -> enhancement

___
Python tracker 

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



[issue28288] Expose environment variable for Py_Py3kWarningFlag

2016-09-27 Thread Brett Cannon

Changes by Brett Cannon :


--
stage:  -> test needed

___
Python tracker 

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



[issue28288] Expose environment variable for Py_Py3kWarningFlag

2016-09-27 Thread Brett Cannon

Changes by Brett Cannon :


--
components: +Interpreter Core -2to3 (2.x to 3.x conversion tool)

___
Python tracker 

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



[issue26477] typing forward references and module attributes

2016-09-27 Thread Guido van Rossum

Guido van Rossum added the comment:

Fixed by 09cc43df4509.

--
nosy: +gvanrossum
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue26075] typing.Union unifies types too broadly

2016-09-27 Thread Guido van Rossum

Guido van Rossum added the comment:

Fixed by 09cc43df4509.

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

___
Python tracker 

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



[issue25830] _TypeAlias: Discrepancy between docstring and behavior

2016-09-27 Thread Guido van Rossum

Guido van Rossum added the comment:

Fixed by 09cc43df4509.

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

___
Python tracker 

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



[issue28291] urllib/urllib2 AbstractDigestAuthHandler locked to retried count of 5

2016-09-27 Thread secynic

secynic added the comment:

It is a very limited use case; I won't gripe about 3.7+ only support. At the 
end of the day, even shown in the comments of that class, it shouldn't be set 
to a static 5 count.

At least this is a very easy patch that won't affect existing code.

--

___
Python tracker 

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



[issue28254] Add C API for gc.enable, gc.disable, and gc.isenabled

2016-09-27 Thread Joe Jevnik

Joe Jevnik added the comment:

I definitely could have used PyImport_Import and PyObject_Call to accomplish 
this task; however, when I looked at at the implementation of these functions 
it seemed like a lot of overhead and book keeping just to set a boolean. Since 
I was already in a C extension it would be nicer to not need to worry about 
PyObjects and ref counts just to set this value so I thought it would be nice 
to expose these small functions to users. Since this is equivalent to gc.enable 
or gc.disable I don't think there is a deep can of worms here. The only 
difference in the implementation is that it doesn't return None. There is 
already PyGC_Collect, so I figured these were just omitted because no one 
thought to add them. I don't have a burning desire to get this in, I just 
thought it would be a nice to have.

--

___
Python tracker 

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



[issue28291] urllib/urllib2 AbstractDigestAuthHandler locked to retried count of 5

2016-09-27 Thread R. David Murray

R. David Murray added the comment:

For (convoluted) background, see issue 8797.

A solution that uses a new would be a new feature and could only go in 3.7, but 
perhaps the solutions in the above issue will point to a backward compatible 
solution.

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



[issue28289] ImportError.__init__ doesn't reset not specified exception attributes

2016-09-27 Thread Brett Cannon

Brett Cannon added the comment:

And I say don't worry about backporting.

--

___
Python tracker 

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



[issue28289] ImportError.__init__ doesn't reset not specified exception attributes

2016-09-27 Thread Brett Cannon

Brett Cannon added the comment:

Patch LGTM.

--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue28283] test_sock_connect_sock_write_race() of test.test_asyncio.test_selector_events fails randomly on FreeBSD

2016-09-27 Thread Berker Peksag

Berker Peksag added the comment:

Just saw 
http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.x%203.5/builds/1136/steps/test/logs/stdio
 and went ahead to remove the test.

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

___
Python tracker 

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



[issue28283] test_sock_connect_sock_write_race() of test.test_asyncio.test_selector_events fails randomly on FreeBSD

2016-09-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cf93671100bf by Berker Peksag in branch '3.5':
Issue #28283: Remove flaky test test_sock_connect_sock_write_race
https://hg.python.org/cpython/rev/cf93671100bf

New changeset b9f18dcbfc4b by Berker Peksag in branch '3.6':
Issue #28283: Merge from 3.5
https://hg.python.org/cpython/rev/b9f18dcbfc4b

New changeset 27fc857ea8af by Berker Peksag in branch 'default':
Issue #28283: Merge from 3.6
https://hg.python.org/cpython/rev/27fc857ea8af

--
nosy: +python-dev

___
Python tracker 

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



[issue28283] test_sock_connect_sock_write_race() of test.test_asyncio.test_selector_events fails randomly on FreeBSD

2016-09-27 Thread Yury Selivanov

Yury Selivanov added the comment:

> I dislike the idea of a test for a race condition which skips itself if it
fails to reproduce the race condition :-/ I like the idea of removing he
unit test.

OK, let's remove the test. I can do that myself in a couple of days.

--

___
Python tracker 

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



[issue28176] Fix callbacks race in asyncio.SelectorLoop.sock_connect

2016-09-27 Thread Berker Peksag

Berker Peksag added the comment:

test_sock_connect_sock_write_race failure is being discussed in issue 28283. 
Closing this again.

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

___
Python tracker 

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



[issue28291] urllib/urllib2 AbstractDigestAuthHandler locked to retried count of 5

2016-09-27 Thread secynic

New submission from secynic:

urllib/urllib2 AbstractDigestAuthHandler is hardcoded to 5 retries 
(self.retried). Normally this wouldn't be an issue.

Certain products link basic HTTP auth to Active Directory (yes, this shouldn't 
be a thing). When you have a failed login attempt lockout set on AD, this will 
lockout accounts on the very first failed Python basic auth attempt, if the AD 
lockout is set to 5 or less.

In my specific use case, I was able to override 
request.HTTPBasicAuthHandler.__init__() and 
request.HTTPBasicAuthHandler.reset_retry_count() by setting self.retried=5. One 
way to fix this would be to add a new retry_count argument to 
AbstractDigestAuthHandler.

I am a bit busy at the moment, but will submit a patch as soon as I get time.

--
components: Library (Lib)
messages: 277549
nosy: secynic
priority: normal
severity: normal
status: open
title: urllib/urllib2 AbstractDigestAuthHandler locked to retried count of 5
type: enhancement
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



[issue27838] test_os.test_chown() random failure on "AMD64 FreeBSD CURRENT Debug 3.x" buildbot

2016-09-27 Thread Berker Peksag

Berker Peksag added the comment:

Perhaps running a script like below on the host would help to identify the 
problem?

import getpass
import grp
import pprint

pprint.pprint(getpass.getuser())
pprint.pprint([(g.gr_gid, g.gr_name) for g in grp.getgrall()])
pprint.pprint([(g.gr_gid, g.gr_name, g.gr_mem) for g in grp.getgrall() if 
getpass.getuser() in g.gr_mem])

--
nosy: +berker.peksag
stage:  -> needs patch
type:  -> behavior
versions: +Python 3.5, Python 3.7

___
Python tracker 

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



[issue28289] ImportError.__init__ doesn't reset not specified exception attributes

2016-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a simple patch.

But I'm not sure that this is a bug.

--
keywords: +patch
stage:  -> patch review
Added file: http://bugs.python.org/file44848/importerror-reset-attributes.patch

___
Python tracker 

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



[issue28117] warning: dereferencing type-punned pointer will break strict-aliasing rules

2016-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Proposed patch eliminates warnings.

--
keywords: +patch
stage: needs patch -> patch review
Added file: http://bugs.python.org/file44847/keccak_warnings.patch

___
Python tracker 

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



[issue28283] test_sock_connect_sock_write_race() of test.test_asyncio.test_selector_events fails randomly on FreeBSD

2016-09-27 Thread STINNER Victor

STINNER Victor added the comment:

I dislike the idea of a test for a race condition which skips itself if it
fails to reproduce the race condition :-/ I like the idea of removing he
unit test.

But I don't have a strong opinion on this issue.

--

___
Python tracker 

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



[issue28281] Remove year limits from calendar

2016-09-27 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

Under my proposal year=-1 is 2 B.C. and year 0 is a leap year

$ ./python.exe -mcalendar 0 2
 February 0
Mo Tu We Th Fr Sa Su
1  2  3  4  5  6
 7  8  9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29

This is the simplest extension and people who require other variants can make 
their own adjustments.  (This suggests that we should probably bring weekday(), 
isleap(), etc. methods to the Calendar class to allow users to override them.)

--

___
Python tracker 

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



[issue28276] test_loading.py - false positive result for "def test_find" when find_library() is not functional or the (shared) library does not exist

2016-09-27 Thread Michael Felt

Michael Felt added the comment:

Actually, what may be needed are more "@skip" blocks - as ctypes has always 
been platform dependent.

OR - have a counter or boolean that starts as zero or false and increase each 
time find_library() returns a value - and the test fails if the counter is 
still zero, or boolean is still false.

Further, perhaps a separate test_load() that is platform specific - with the 
correct - read expected - result from find_library(). I say expected because 
python has always been testing for libc.so.6 while I see in cloud-init that 
that are calls hard-coded to CDLL("libc.so.7") - but maybe that is something 
specific for Canonical aka ubuntu.

However, it seems that expecting libc.so.6 to ALWAYS be present is not safe.

FYI:

michael@x071:[/data/prj/python/cloud-init]grep CDLL cloud-init-0*/cloudinit/*.py
cloud-init-0.7.5/cloudinit/util.py:libc = 
ctypes.CDLL('/lib/libc.so.7')
cloud-init-0.7.8/cloudinit/util.py:libc = 
ctypes.CDLL('/lib/libc.so.7')

--

___
Python tracker 

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



[issue28290] BETA report: Python-3.6 build messages to stderr: AIX and "not GCC"

2016-09-27 Thread Christian Heimes

Christian Heimes added the comment:

blake2 is a hash algorithm. It uses #pragma pack(push, 1) and #pragma pack(pop) 
to change packing rules for structs.

--
nosy: +christian.heimes

___
Python tracker 

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



[issue28281] Remove year limits from calendar

2016-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think data range is limited by year 1 due to ambiguity of year -1. Is it 1 
B.D. or 2 years before year 1 (2 B.D.)?

--

___
Python tracker 

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



[issue28253] calendar.prcal(9999) output has a problem

2016-09-27 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee: serhiy.storchaka -> belopolsky

___
Python tracker 

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



[issue20947] -Wstrict-overflow findings

2016-09-27 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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



[issue20947] -Wstrict-overflow findings

2016-09-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset dad879edefd2 by Serhiy Storchaka in branch '3.5':
Issue #20947: Fixed a gcc warning with -Wstrict-overflow.
https://hg.python.org/cpython/rev/dad879edefd2

New changeset 5ecbe8a55ccd by Serhiy Storchaka in branch '3.6':
Issue #20947: Fixed a gcc warning with -Wstrict-overflow.
https://hg.python.org/cpython/rev/5ecbe8a55ccd

New changeset 675d3f76444d by Serhiy Storchaka in branch 'default':
Issue #20947: Fixed a gcc warning with -Wstrict-overflow.
https://hg.python.org/cpython/rev/675d3f76444d

--
nosy: +python-dev

___
Python tracker 

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



[issue28253] calendar.prcal(9999) output has a problem

2016-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The patch LGTM.

You can see how itermonthdates() is used in third-party code:

https://github.com/sunlightlabs/django-locksmith/blob/master/locksmith/hub/dataviews.py
https://github.com/quandyfactory/Quandy/blob/master/quandy.py
https://github.com/takanory/plone.app.event/blob/master/plone/app/event/portlets/portlet_calendar.py
https://github.com/gerow/gnome-shell-google-calendar/blob/master/gnome-shell-google-calendar.py
https://bitbucket.org/benallard/msgboard/src/1c08fa3ba040f8151d0e28130b01b30e0595e448/msgboard/controller.py?at=default

--

___
Python tracker 

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



[issue28290] BETA report: Python-3.6 build messages to stderr: AIX and "not GCC"

2016-09-27 Thread Michael Felt

New submission from Michael Felt:

GCC and IBM xlC compilers pay attention to different things - so some of the 
messages are "accepted" if not harmless.

e.g. this type:
"./Modules/xxsubtype.c", line 293.19: 1506-196 (W) Initialization between types 
"void*" and "int(*)(struct _object*)" is not allowed.

Others are (well)-known different compiler behaviors - such as the default sign 
of a 'bit-field'
"/data/prj/python/python-3.6.0.177/Modules/_ctypes/_ctypes_test.c", line 389.5: 
1506-159 (E) Bit field type specified for M is not valid. Type unsigned assumed.

However, some of the messages may lead to a problem down the road. Might be the 
platform, might be the "converted" include files:

"./pyconfig.h", line 1448.9: 1506-236 (W) Macro name _POSIX_C_SOURCE has been 
redefined.
"./pyconfig.h", line 1448.9: 1506-358 (I) "_POSIX_C_SOURCE" is defined on line 
147 of /usr/include/standards.h.
"./pyconfig.h", line 1460.9: 1506-236 (W) Macro name _XOPEN_SOURCE has been 
redefined.
"./pyconfig.h", line 1460.9: 1506-358 (I) "_XOPEN_SOURCE" is defined on line 
143 of /usr/include/standards.h.

And others might be more of an issue - e.g., no idea what "_blake2" is - does 
not look 'happy' or safe:
"/data/prj/python/python-3.6.0.177/Modules/_blake2/impl/blake2.h", line 89.14: 
1506-508 (W) Option push for pragma pack is not supported.
"/data/prj/python/python-3.6.0.177/Modules/_blake2/impl/blake2.h", line 89.1: 
1506-224 (W) Incorrect pragma ignored.
"/data/prj/python/python-3.6.0.177/Modules/_blake2/impl/blake2.h", line 119.14: 
1506-726 (W) Attempting to pop an empty pack stack. Current pack may change.

That pretty well summarizes what is in the file - stdout was directed to a file

--
components: Build
files: build-python-3.6.0.b1.script
messages: 277538
nosy: Michael.Felt
priority: normal
severity: normal
status: open
title: BETA report: Python-3.6 build messages to stderr: AIX and "not GCC"
Added file: http://bugs.python.org/file44846/build-python-3.6.0.b1.script

___
Python tracker 

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



[issue28290] BETA report: Python-3.6 build messages to stderr: AIX and "not GCC"

2016-09-27 Thread Michael Felt

Changes by Michael Felt :


--
versions: +Python 3.6

___
Python tracker 

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



[issue28289] ImportError.__init__ doesn't reset not specified exception attributes

2016-09-27 Thread Brett Cannon

Brett Cannon added the comment:

I think it's a bug, but a low priority one.

--
priority: normal -> low

___
Python tracker 

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



[issue27777] cgi.FieldStorage can't parse simple body with Content-Length and no Content-Disposition

2016-09-27 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for triaging this, Bert. Would you like to propose a patch with a test 
case?

Note that we can't fix this in 3.3 and 3.4 because they are in 
security-fix-only mode. See 
https://docs.python.org/devguide/index.html#status-of-python-branches for 
details.

--
stage:  -> needs patch
type:  -> behavior
versions:  -Python 3.3, Python 3.4

___
Python tracker 

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



[issue27873] multiprocessing.pool.Pool.map should take more than one iterable

2016-09-27 Thread Berker Peksag

Berker Peksag added the comment:

I think we can add a note for starmap() in the following sentence:

> [...] (it supports only one iterable argument though).

(Quoted from 
https://docs.python.org/3/library/multiprocessing.html#multiprocessing.pool.Pool.map)

Would you like to write a patch?

--
components: +Documentation -Interpreter Core
keywords: +easy
nosy: +berker.peksag
stage:  -> needs patch
versions: +Python 3.5, Python 3.7

___
Python tracker 

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



[issue28289] ImportError.__init__ doesn't reset not specified exception attributes

2016-09-27 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

ImportError.__init__ sets only specified attributes ("msg", "name" or "path"), 
and left not explicitly specified attributes unchanged.

>>> err = ImportError('test', name='name')
>>> err.args, err.msg, err.name, err.path
(('test',), 'test', 'name', None)
>>> err.__init__(path='path')
>>> err.args, err.msg, err.name, err.path
((), 'test', 'name', 'path')

In above example err.__init__(path='path') sets attributes "args" and "path", 
but not "msg" and "name".

I'm not sure whether can this be considered as a bug.

--
components: Interpreter Core
messages: 277533
nosy: brett.cannon, eric.snow, ncoghlan, serhiy.storchaka
priority: normal
severity: normal
status: open
title: ImportError.__init__ doesn't reset not specified exception attributes
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



[issue21578] Misleading error message when ImportError called with invalid keyword args

2016-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Added a test for multiple invalid keyword arguments, added braces, fixed a leak.

But there is other oddity in ImportError constructor (issue28289).

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



[issue28253] calendar.prcal(9999) output has a problem

2016-09-27 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

issue28253-4.diff should be good now.

--

___
Python tracker 

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



[issue28253] calendar.prcal(9999) output has a problem

2016-09-27 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


Removed file: http://bugs.python.org/file44837/issue28253-4.diff

___
Python tracker 

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



[issue28253] calendar.prcal(9999) output has a problem

2016-09-27 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


Added file: http://bugs.python.org/file44845/issue28253-4.diff

___
Python tracker 

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



[issue21578] Misleading error message when ImportError called with invalid keyword args

2016-09-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9b8f0db1944f by Serhiy Storchaka in branch '3.5':
Issue #21578: Fixed misleading error message when ImportError called with
https://hg.python.org/cpython/rev/9b8f0db1944f

New changeset 95549f4970d0 by Serhiy Storchaka in branch '3.6':
Issue #21578: Fixed misleading error message when ImportError called with
https://hg.python.org/cpython/rev/95549f4970d0

New changeset 59268ac85f4e by Serhiy Storchaka in branch 'default':
Issue #21578: Fixed misleading error message when ImportError called with
https://hg.python.org/cpython/rev/59268ac85f4e

--
nosy: +python-dev

___
Python tracker 

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



[issue28253] calendar.prcal(9999) output has a problem

2016-09-27 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

Something went wrong with issue28253-4.diff.  I'll investigate and replace.

--

___
Python tracker 

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



[issue28275] LZMADecompressor.decompress Use After Free

2016-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Committed with small changes. Thank you John for your contribution.

Tested that 3.4 is not affected.

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



[issue28275] LZMADecompressor.decompress Use After Free

2016-09-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b4c0e733b342 by Serhiy Storchaka in branch '3.5':
Issue #28275: Fixed possible use adter free in LZMADecompressor.decompress().
https://hg.python.org/cpython/rev/b4c0e733b342

New changeset 52f8eb2fa6a6 by Serhiy Storchaka in branch '3.6':
Issue #28275: Fixed possible use adter free in LZMADecompressor.decompress().
https://hg.python.org/cpython/rev/52f8eb2fa6a6

New changeset 6117d0e1a5c9 by Serhiy Storchaka in branch 'default':
Issue #28275: Fixed possible use adter free in LZMADecompressor.decompress().
https://hg.python.org/cpython/rev/6117d0e1a5c9

--
nosy: +python-dev

___
Python tracker 

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



[issue28283] test_sock_connect_sock_write_race() of test.test_asyncio.test_selector_events fails randomly on FreeBSD

2016-09-27 Thread Yury Selivanov

Yury Selivanov added the comment:

Berker, I think it's an OK workaround. The test is kind of unstable, to the 
point of me thinking to just remove it (keeping the rest of the patch applied). 
Feel free to apply it.

--

___
Python tracker 

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



[issue28281] Remove year limits from calendar

2016-09-27 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

> What's the use case for this?

Why did George Mallory climb Mount Everest? "Because it's there."

We have two open issues complaining about calendar behavior for years 1 and 
: #28253 and #26650.  There is also a closed issue #15421 that attempted to 
fix an overflow in the year  only to introduce a silent error.

I don't think there are use cases beyond educational (demonstrating calendar 
periodicity?) or testing, but since several users bothered to report edge case 
bugs, it is probably easier to remove the limits than to properly document them.

Fortunately, extending calendar to arbitrary years does not require climbing 
Mount Everest.  Since the proleptic calendar repeats every 400 years, all we 
need (assuming issue 28253 patch is applied) is to fix the weekday() function 
as follows:

 def weekday(year, month, day):
 """Return weekday (0-6 ~ Mon-Sun) for year (1970-...), month (1-12),
day (1-31)."""
+if not 0 < year < 1:
+year = 2000 + year % 400
 return datetime.date(year, month, day).weekday()

$ ./python.exe -mcalendar 4 12
   December 4
Mo Tu We Th Fr Sa Su
 1  2  3
 4  5  6  7  8  9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

$ ./python.exe -mcalendar -104 2
   February -104
Mo Tu We Th Fr Sa Su
1  2
 3  4  5  6  7  8  9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29

We can also treat negative years "properly" so that year 1 is preceded by year 
-1, but I don't think there is any value in this.

--
dependencies: +calendar.prcal() output has a problem
keywords: +easy
nosy: +xiang.zhang

___
Python tracker 

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



[issue28247] Add an option to zipapp to produce a Windows executable

2016-09-27 Thread Brett Cannon

Brett Cannon added the comment:

I think documentation is definitely the cheapest option. It's also the most 
flexible since if we find out there's a lot of usage of the guide then we can 
add explicit support.

--

___
Python tracker 

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



[issue28247] Add an option to zipapp to produce a Windows executable

2016-09-27 Thread Paul Moore

Paul Moore added the comment:

I'm still unsure whether this would be a good idea. On the plus side, it 
provides (in conjunction with the "embedded" distribution) a really good way of 
producing a standalone application on Windows. On the minus side there are some 
limitations which may trip up naive users:

* You can't put C extensions in a zipapp
* You have to take care with things like multiprocessing if you're using an 
embedded app.

And the wrapper's basically only 4 lines of code:

wchar_t **myargv = _alloca((__argc + 2) * sizeof(wchar_t*));
myargv[0] = __wargv[0];
memcpy(myargv + 1, __wargv, (__argc + 1) * sizeof(wchar_t *));
return Py_Main(__argc+1, myargv);

so it's not exactly rocket science. (By the way, the arguments to Py_Main are 
"exactly as those which are passed to a C program’s main" - IIRC, for a C 
program there's always a NULL pointer at the end of argv, does that rule apply 
to Py_Main, too? The code doesn't seem to rely on it, so I guess I could save a 
slot in the array above).

Maybe adding a section to the zipapp docs explaining how to make standalone 
applications would be a better way of handling this? That would have the 
advantage of being just as applicable to 3.6 (and 3.5, for that matter) at the 
cost of making users build their own wrapper (or find a published one).

--

___
Python tracker 

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



[issue28253] calendar.prcal(9999) output has a problem

2016-09-27 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

> The patch LGTM except tests.

What are your issues with the tests?  Did you see the -4 patch?

> But we should at least document the behavior of itermonthdates(), 
> monthdatescalendar() and yeardatescalendar() at corner cases.

I would rather not. At least not before we make under and overflow behavior 
consistent.  Frankly, I don't see why anyone would want to use these iterators.

--
stage:  -> commit review

___
Python tracker 

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



[issue28288] Expose environment variable for Py_Py3kWarningFlag

2016-09-27 Thread Roy Williams

New submission from Roy Williams:

I'm finding the `-3` flag to be super useful, but it's quite a huge pain to 
thread it through all of the places that spawn python subprocesses, sometimes 
requiring forking of third party code.

This would be much simpler if, like PYTHONWARNINGS, Py_Py3kWarningFlag could be 
specified as an environment variable.

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 277522
nosy: Roy Williams
priority: normal
severity: normal
status: open
title: Expose environment variable for Py_Py3kWarningFlag
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



[issue21578] Misleading error message when ImportError called with invalid keyword args

2016-09-27 Thread Brett Cannon

Changes by Brett Cannon :


--
assignee: berker.peksag -> serhiy.storchaka

___
Python tracker 

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



[issue21578] Misleading error message when ImportError called with invalid keyword args

2016-09-27 Thread Brett Cannon

Brett Cannon added the comment:

Left a review, but basically LGTM.

--

___
Python tracker 

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



[issue28283] test_sock_connect_sock_write_race() of test.test_asyncio.test_selector_events fails randomly on FreeBSD

2016-09-27 Thread Berker Peksag

Berker Peksag added the comment:

> If nobody fixes the unit test, I will revert the change.

I attached a patch that skips the test in case of a timeout in issue 28176. Did 
you had a chance to take a look at it?

--
nosy: +berker.peksag
stage:  -> needs patch
type:  -> behavior
versions: +Python 3.5

___
Python tracker 

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



[issue21578] Misleading error message when ImportError called with invalid keyword args

2016-09-27 Thread Berker Peksag

Berker Peksag added the comment:

Serhiy's patch looks good to me.  It would be nice to add a test for multiple 
invalid keyword arguments:

with self.assertRaisesRegex(TypeError, msg):
ImportError('test', invalid='keyword', another=True)

Using empty_tuple seems reasonable to me. Brett and Eric, what do you think?

--

___
Python tracker 

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



[issue28115] Use argparse for the zipfile module

2016-09-27 Thread SilentGhost

SilentGhost added the comment:

Jaysinh, you can upload your modified patch, so it can be reviewed.

--

___
Python tracker 

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



[issue28287] Refactor subprocess.Popen to let a subclass handle IO asynchronously

2016-09-27 Thread Martin Richard

New submission from Martin Richard:

Hi,

Currently, subprocess.Popen performs blocking IO in its constructor (at least 
on Unix): it reads on a pipe in order to detect outcome of the pre-exec and 
exec phase in the new child. There is no way yet to modify this behavior as 
this blocking call is part of a long Popen._execute_child() method.

This is a problem in asyncio (asyncio.subprocess_exec and 
asyncio.subprocess_shell).

I would like to submit a patch which breaks Popen.__init__() and 
Popen._execute_child() in several methods so it becomes possible to avoid 
blocking calls (read on pipe and waitpid) by overriding a few private methods 
without duplicating too much code. The goal is to use it in asyncio, as 
described in this pull request (which currently monkey-patches Popen):
https://github.com/python/asyncio/pull/428

This patch only targets the unix implementation.

Thanks for your feedback.

--
files: popen_execute_child_refactoring.patch
keywords: patch
messages: 277517
nosy: martius
priority: normal
severity: normal
status: open
title: Refactor subprocess.Popen to let a subclass handle IO asynchronously
type: enhancement
versions: Python 3.6
Added file: 
http://bugs.python.org/file44844/popen_execute_child_refactoring.patch

___
Python tracker 

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



[issue21578] Misleading error message when ImportError called with invalid keyword args

2016-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ping.

--
versions: +Python 3.7 -Python 3.4

___
Python tracker 

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



[issue28286] gzip guessing of mode is ambiguilous

2016-09-27 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

gzip.GzipFile can be open in two modes: reading and writing. The mode is 
specified by the mode parameter, but if it is not specified or is None, the 
mode is determined by the mode of passed file object. The problem is that the 
file object can support reading and writing. If the file object is opened with 
mode "rb", "rb+" or "wb+" (see also issue25341), GzipFile will be opened for 
reading. If the file object is opened with mode "wb", "ab", "ab+", "xb", or 
"xb+", GzipFile will be opened for writing. Modes "rb+", "wb+", "ab+" and "xb+" 
support reading and writing, and GzipFile's choose looks arbitrary.

bz2 and lzma are free from this arbitrariness. The default value of the mode 
parameter is "r", and they never use file's mode as a guess.

This feature of the gzip module is not tested. Changing the default value of 
mode to "r" doesn't break gzip tests. But for certainty we should first 
deprecate this feature before dropping it.

--
components: Library (Lib)
files: gzip_deprecate_implicit_write.patch
keywords: patch
messages: 277515
nosy: nadeem.vawda, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: gzip guessing of mode is ambiguilous
type: enhancement
versions: Python 3.7
Added file: http://bugs.python.org/file44843/gzip_deprecate_implicit_write.patch

___
Python tracker 

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



[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-09-27 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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



[issue27963] null poiter dereference in set_conversion_mode due uncheck _ctypes_conversion_errors

2016-09-27 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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



[issue27963] null poiter dereference in set_conversion_mode due uncheck _ctypes_conversion_errors

2016-09-27 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
type: security -> crash

___
Python tracker 

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



[issue27963] null poiter dereference in set_conversion_mode due uncheck _ctypes_conversion_errors

2016-09-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 637ce96423ef by Serhiy Storchaka in branch '2.7':
Issue #27963: Fixed possible null pointer dereference in 
ctypes.set_conversion_mode().
https://hg.python.org/cpython/rev/637ce96423ef

--
nosy: +python-dev

___
Python tracker 

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



[issue27683] ipaddress subnet slicing iterator malfunction

2016-09-27 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
stage: needs patch -> patch review
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



[issue27963] null poiter dereference in set_conversion_mode due uncheck _ctypes_conversion_errors

2016-09-27 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
stage:  -> patch review

___
Python tracker 

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



[issue27275] KeyError thrown by optimised collections.OrderedDict.popitem()

2016-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Proposed patch makes the implementation of pop() and popitem() methods of the C 
implementation of OrderedDict matching the Python implementation. This fixes 
issue28014 and I suppose this fixes this issue too.

--
keywords: +patch
stage: test needed -> patch review
versions: +Python 3.7
Added file: http://bugs.python.org/file44842/ordered_dict_subclass_pop.patch

___
Python tracker 

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



[issue27572] Support bytes-like objects when base is given to int()

2016-09-27 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: 
http://bugs.python.org/file44841/deprecate_byte_like_support_in_int.patch

___
Python tracker 

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



[issue27572] Support bytes-like objects when base is given to int()

2016-09-27 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Removed file: 
http://bugs.python.org/file44840/deprecate_byte_like_support_in_int.patch

___
Python tracker 

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



[issue28285] 35.5 - 29.58 = 5.920000000000002 (it's false !)

2016-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

https://docs.python.org/3/tutorial/floatingpoint.html

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



[issue28285] 35.5 - 29.58 = 5.920000000000002 (it's false !)

2016-09-27 Thread Hogren

New submission from Hogren:

I was using python as calculator when I enter :
35.5 - 29.58

I am surprising when python give me a result with many decimals:
5.922

I tried to change one number :
35.5 - 29.57
The result is correct : 5.93

The error is present again when I tried to inverse numbers (29.57-35.5).

The error is again present when I tried to use 35.50 in place of 35.5.



I tested on python 2.7 and 3.4, compiled with gcc 4.9.3, on Gentoo.


Thanks for all who contribute to this good project which is Python !

Hogren

--
messages: 277511
nosy: Hogren
priority: normal
severity: normal
status: open
title: 35.5 - 29.58 = 5.922 (it's false !)
type: behavior
versions: Python 2.7, 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



[issue27411] Possible different behaviour of explicit and implicit __dict__ accessing when involving builtin types' __dict__ descriptors

2016-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

See also issue26906.

--

___
Python tracker 

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



  1   2   >