[issue28509] dict.update allocates too much

2016-10-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> Dict is resized. And since __dict__.update() caused the resizing,
both are normal (combined) dict.

Ah, my bad, I missed this point. The original issue now disappears. Thanks 
Naoki.

But dict.update (and maybe inserting) can use more economical allocation 
strategy.

--
stage:  -> needs patch
title: Key-sharing dictionaries can inrease the memory consumption -> 
dict.update allocates too much
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



[issue25953] re fails to identify invalid numeric group references in replacement strings

2016-10-23 Thread SilentGhost

SilentGhost added the comment:

Updated patch fixing the position issue.

--
Added file: http://bugs.python.org/file45194/25953_5.diff

___
Python tracker 

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



[issue25953] re fails to identify invalid numeric group references in replacement strings

2016-10-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM. Thank you for your contribution SilentGhost.

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



[issue25953] re fails to identify invalid numeric group references in replacement strings

2016-10-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cea983246919 by Serhiy Storchaka in branch '3.6':
Issue #25953: re.sub() now raises an error for invalid numerical group
https://hg.python.org/cpython/rev/cea983246919

New changeset 15e3695affa2 by Serhiy Storchaka in branch 'default':
Issue #25953: re.sub() now raises an error for invalid numerical group
https://hg.python.org/cpython/rev/15e3695affa2

--
nosy: +python-dev

___
Python tracker 

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



[issue28498] tk busy command

2016-10-23 Thread Miguel

Miguel added the comment:

Hi klappnase,
you are right with the function tk_busy_configure(). Maybe there is a little 
bit of code duplicated. I think that it's better to directly change the Tkinter 
function _configure() to make it more general:
def _configure(self, cmd, cnf, kw):
"""Internal function."""
if kw:
cnf = _cnfmerge((cnf, kw))
elif cnf:
cnf = _cnfmerge(cnf)
if cnf is None:
return self._getconfigure(cmd)
if isinstance(cnf, str):
return self._getconfigure1(cmd + ('-'+cnf,))
self.tk.call(cmd + self._options(cnf))

I think that it's interesting to do this change because the function is more 
general and maybe can be used again in the future for new features in Tcl Tk. 
This way, we avoid code duplication (Dont Repeat Yourself is one of the 
philosophes of Python). This is the new version of tk_busy_configure using the 
mentioned change:
def tk_busy_configure(self, cnf=None, **kw):
return self._configure(('tk', 'busy', 'configure', self._w), cnf, kw)

It's more concise.
I disagree with tk_busy_status(). It's better to be more predictable an return 
the same than the other methods that uses getboolean(). If there is a bug, it's 
better to solve that bug.  Could you please guive me an code example that 
replicates the bug?

The _getboolean function is implemented in _tkinter.c. This is the 
implementation:
static PyObject *
Tkapp_GetBoolean (self, args)
 PyObject *self;
 PyObject *args;
{
  char *s;
  int v;

  if (!PyArg_Parse (args, "s", &s))
return NULL;
  if (Tcl_GetBoolean (Tkapp_Interp (self), s, &v) == TCL_ERROR)
return Tkinter_Error (self);
  return Py_BuildValue ("i", v);
}

A priori , I can't appreciate any bug in this function. If there is some bug, 
it's in another place of the C code.

--

___
Python tracker 

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



[issue28469] timeit: use powers of 2 in autorange(), instead of powers of 10

2016-10-23 Thread STINNER Victor

STINNER Victor added the comment:

timeit_autorange_numbers.patch: LGTM.

--

___
Python tracker 

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



[issue28498] tk busy command

2016-10-23 Thread Miguel

Miguel added the comment:

Tcl_GetBoolean() converts a boolean string to an integer 0 or 1:
https://www.tcl.tk/man/tcl8.6/TclLib/GetInt.htm

and then Py_BuildValue() converts the integer to a Python object:
https://docs.python.org/2/c-api/arg.html

--

___
Python tracker 

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



[issue28498] tk busy command

2016-10-23 Thread Miguel

Miguel added the comment:

Ok. Maybe the bug is here:

   Misc.getboolean()

This is the required change:
def getboolean(self, s):
"""Return a boolean value for Tcl boolean values true and false given 
as parameter."""
return bool(self.tk.getboolean(s))

--

___
Python tracker 

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



[issue25953] re fails to identify invalid numeric group references in replacement strings

2016-10-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Committed with additional changes. Fixed yet one occurrence of "invalid group 
reference" without group index, and made small style changes.

--
resolution:  -> fixed
stage: commit 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



[issue28115] Use argparse for the zipfile module

2016-10-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 042c923c5b67 by Serhiy Storchaka in branch '2.7':
Issue #28115: Added tests for CLI of the zipfile module.
https://hg.python.org/cpython/rev/042c923c5b67

New changeset 900c47c98711 by Serhiy Storchaka in branch '3.5':
Issue #28115: Added tests for CLI of the zipfile module.
https://hg.python.org/cpython/rev/900c47c98711

New changeset a1975621bba2 by Serhiy Storchaka in branch '3.6':
Issue #28115: Added tests for CLI of the zipfile module.
https://hg.python.org/cpython/rev/a1975621bba2

New changeset 5edac3b55130 by Serhiy Storchaka in branch 'default':
Issue #28115: Added tests for CLI of the zipfile module.
https://hg.python.org/cpython/rev/5edac3b55130

--
nosy: +python-dev

___
Python tracker 

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



[issue28513] Documment zipfile CLI

2016-10-23 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Command-line interface of the zipfile module is supported long time, but it is 
not documented. Proposed patch documents it. It is based on the documentation 
of tarfile CLI.

--
assignee: docs@python
components: Documentation
files: zipfile_cli_docs.patch
keywords: patch
messages: 279250
nosy: alanmcintyre, berker.peksag, docs@python, serhiy.storchaka, twouters
priority: normal
severity: normal
stage: patch review
status: open
title: Documment zipfile CLI
type: enhancement
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file45195/zipfile_cli_docs.patch

___
Python tracker 

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



[issue28513] Document zipfile CLI

2016-10-23 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
title: Documment zipfile CLI -> Document zipfile CLI

___
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-10-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fa275e570d52 by Serhiy Storchaka in branch 'default':
Issue #28115: Command-line interface of the zipfile module now uses argparse.
https://hg.python.org/cpython/rev/fa275e570d52

--

___
Python tracker 

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



[issue28498] tk busy command

2016-10-23 Thread klappnase

klappnase added the comment:

As far as I can see, most internal Tkinter methods use _getboolean(), which 
currently looks like:

def _getboolean(self, string):
"""Internal function."""
if string:
return self.tk.getboolean(string)

I am not 100% sure about this, but I figure that when this was written it was 
intentional that if "string" is an empty string, it should return None instead 
of (back then) 0 or 1. Today this would probably translate into something like:

def _getboolean(self, value):
if not value in ('', None):
return bool(self.tk.getboolean(value))

--

___
Python tracker 

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



[issue28511] Use the "U" format for parsing Unicode object arg in PyArg_Parse*

2016-10-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d667913a81c6 by Serhiy Storchaka in branch 'default':
Issue #28511: Use the "U" format instead of "O!" in PyArg_Parse*.
https://hg.python.org/cpython/rev/d667913a81c6

--
nosy: +python-dev

___
Python tracker 

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



[issue28469] timeit: use powers of 2 in autorange(), instead of powers of 10

2016-10-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8e6cc952adc6 by Serhiy Storchaka in branch 'default':
Issue #28469: timeit now uses the sequence 1, 2, 5, 10, 20, 50,... instead
https://hg.python.org/cpython/rev/8e6cc952adc6

--
nosy: +python-dev

___
Python tracker 

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



[issue28469] timeit: use powers of 2 in autorange(), instead of powers of 10

2016-10-23 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



[issue28511] Use the "U" format for parsing Unicode object arg in PyArg_Parse*

2016-10-23 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

will you close the issue ?

--
nosy: +matrixise

___
Python tracker 

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



[issue28513] Document zipfile CLI

2016-10-23 Thread Stéphane Wirtel

Changes by Stéphane Wirtel :


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



[issue28513] Document zipfile CLI

2016-10-23 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

Serhiy, your patch seems to be good, you can merge it, I have tested it with 
sphinx and the documentation is fine.

Thanks

--
nosy: +matrixise

___
Python tracker 

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



[issue28439] Remove redundant checks in PyUnicode_EncodeLocale and PyUnicode_DecodeLocaleAndSize

2016-10-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 94d34354bef1 by Serhiy Storchaka in branch 'default':
Issue #28439: Remove redundant checks in PyUnicode_EncodeLocale and
https://hg.python.org/cpython/rev/94d34354bef1

--
nosy: +python-dev

___
Python tracker 

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



[issue28439] Remove redundant checks in PyUnicode_EncodeLocale and PyUnicode_DecodeLocaleAndSize

2016-10-23 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



[issue28488] shutil.make_archive (xxx, zip, root_dir) is adding './' entry to archive which is wrong

2016-10-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 847537b7924c by Serhiy Storchaka in branch '2.7':
Issue #28488: shutil.make_archive() no longer adds entry "./" to ZIP archive.
https://hg.python.org/cpython/rev/847537b7924c

New changeset d4fce66ebe01 by Serhiy Storchaka in branch '3.5':
Issue #28488: shutil.make_archive() no longer adds entry "./" to ZIP archive.
https://hg.python.org/cpython/rev/d4fce66ebe01

New changeset e93149fee04d by Serhiy Storchaka in branch '3.6':
Issue #28488: shutil.make_archive() no longer adds entry "./" to ZIP archive.
https://hg.python.org/cpython/rev/e93149fee04d

New changeset 72da53d3074b by Serhiy Storchaka in branch 'default':
Issue #28488: shutil.make_archive() no longer adds entry "./" to ZIP archive.
https://hg.python.org/cpython/rev/72da53d3074b

--
nosy: +python-dev

___
Python tracker 

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



[issue26656] Documentation for re.compile is a bit outdated

2016-10-23 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

What do you propose for the doc of re.compile ?

--
nosy: +matrixise

___
Python tracker 

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



[issue28514] Crash

2016-10-23 Thread Kamran

New submission from Kamran:

Hi,

I am writing to inform you about the Python Program. Whenever I go onto the
program it works but as soon as I save a piece of work it crashes and
freezes. After that it says Python.exe has stopped working. The Windows
that I am using is Windows 7 Proffessional. Is there any way you can fix
this fault??? Please do this as soon as possibe as I need this piece of
work ASAP?!?

MANY THANKS
*Kamran Muhammad*

--
messages: 279260
nosy: Kamran
priority: normal
severity: normal
status: open
title: Crash

___
Python tracker 

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



[issue28514] Python (IDLE?) freezes on file save on Windows

2016-10-23 Thread Emanuel Barry

Emanuel Barry added the comment:

Could provide more information on the issue? Which program exactly is failing? 
Is it the IDLE editor? If you don't know what you're using, you can provide a 
screenshot as a last resort (but don't provide one if you can figure out the 
program that freezes).

--
nosy: +ebarry
stage:  -> test needed
title: Crash -> Python (IDLE?) freezes on file save on Windows
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



[issue28498] tk busy command

2016-10-23 Thread klappnase

klappnase added the comment:

Hi Miguel,
about _configure() :
the code you suggest:

def _configure(self, cmd, cnf, kw):
"""Internal function."""
if kw:
cnf = _cnfmerge((cnf, kw))
elif cnf:
cnf = _cnfmerge(cnf)
if cnf is None:
return self._getconfigure(cmd)
if isinstance(cnf, str):
return self._getconfigure1(cmd + ('-'+cnf,))
self.tk.call(cmd + self._options(cnf))

will break all other methods that use configure() and friends. A possible way 
to work around this might be:

def _configure(self, cmd, cnf, kw):
"""Internal function."""
if kw:
cnf = _cnfmerge((cnf, kw))
elif cnf:
cnf = _cnfmerge(cnf)
if not self._w in cmd:
cmd = _flatten((self._w, cmd))
if cnf is None:
return self._getconfigure(cmd)
if isinstance(cnf, str):
return self._getconfigure1(cmd + ('-'+cnf,))
self.tk.call(cmd + self._options(cnf))

Not sure if this is smart, though, it might require some thorough testing.

About getboolean() :

it seems like tkapp.getboolean() returns 1 or 0 when it is passed an integer 
value, at least this is still true here for Python-3.4.2:

$ python3
Python 3.4.2 (default, Oct  8 2014, 10:45:20) 
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from tkinter import *
>>> r=Tk()
>>> getboolean(1)
1
>>> getboolean('1')
True
>>> getboolean('yes')
True
>>> getboolean(True)
True
>>> 


Probably the best thing to do would be to fix this in the C code. The next best 
thing I think is to change tkinter.getboolean(), tkinter.Misc.getboolean() and 
tkinter.Misc._getboolean(). This however leaves a number of Tkinter methods 
like e.g. Text.compare() which directly use self.tk.getboolean() unresolved.

--

___
Python tracker 

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



[issue25152] venv documentation doesn't tell you how to specify a particular version of python

2016-10-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

http://buildbot.python.org/all/builders/Docs%203.x/builds/2710/steps/lint/logs/stdio
python3 tools/rstlint.py -i tools -i venv
[2] library/venv.rst:27: default role used
1 problem with severity 2 found.
Makefile:156: recipe for target 'check' failed

--
nosy: +serhiy.storchaka
status: closed -> open

___
Python tracker 

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



[issue28514] Python (IDLE?) freezes on file save on Windows

2016-10-23 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

Sorry Kamran, but you don't produce any information, there is a stacktrace, a 
backtrace ?

In this case, we can't reproduce your issue and we can't help you.

And, we can't provide a patch because you need it ASAP :/

--
nosy: +matrixise

___
Python tracker 

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



[issue28487] missing _math.o target in 2.7 Makefile

2016-10-23 Thread Skip Montanaro

Skip Montanaro added the comment:

The problem is solved. It seems there were changes in my 2.7 checkout which hg 
update wouldn't overwrite. I vaguely remember applying somebody's patch for a 
bug quite awhile ago. Apparently, I failed to revert that change before moving 
on.

I obviously wasn't paying close attention, but I'm still kind of surprised that 
hg update wouldn't tell me about files it couldn't update based on local 
changes.

--

___
Python tracker 

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



[issue28511] Use the "U" format for parsing Unicode object arg in PyArg_Parse*

2016-10-23 Thread Xiang Zhang

Changes by Xiang Zhang :


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



[issue25152] venv documentation doesn't tell you how to specify a particular version of python

2016-10-23 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

> [2] library/venv.rst:27: default role used
> 1 problem with severity 2 found.

I made a patch to address it. Please review. Thanks :)

--
keywords: +patch
nosy: +Mariatta
Added file: http://bugs.python.org/file45196/issue25152.patch

___
Python tracker 

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



[issue25152] venv documentation doesn't tell you how to specify a particular version of python

2016-10-23 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

we can merge the patch of Mariatta

--
nosy: +matrixise
stage: resolved -> commit review

___
Python tracker 

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



[issue28488] shutil.make_archive (xxx, zip, root_dir) is adding './' entry to archive which is wrong

2016-10-23 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



[issue28515] Py3k warnings in Python 2.7 tests

2016-10-23 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Several warnings are emitted when run Python 2.7 tests with -Wd -3 options.

1. "DeprecationWarning: <> not supported in 3.x; use !=" and 
"DeprecationWarning: dict.has_key() not supported in 3.x; use the in operator" 
in Tools/scripts/fixcid.py.

2. "DeprecationWarning: Overriding __eq__ blocks inheritance of __hash__ in 
3.x" in Lib/test/pickletester.py.

3. "SyntaxWarning: tuple parameter unpacking has been removed in 3.x" in 
Lib/lib-tk/turtle.py.

Proposed patch fixes these warnings.

--
components: Tests
files: tests_py3k_warns.patch
keywords: patch
messages: 279268
nosy: benjamin.peterson, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Py3k warnings in Python 2.7 tests
versions: Python 2.7
Added file: http://bugs.python.org/file45197/tests_py3k_warns.patch

___
Python tracker 

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



[issue28515] Py3k warnings in Python 2.7 tests

2016-10-23 Thread R. David Murray

R. David Murray added the comment:

I don't think it should ever be necessary to raise unhashable type from a 
__hash__ method.  Can't you just set it to None?

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



[issue28515] Py3k warnings in Python 2.7 tests

2016-10-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yes, this work just great! And even generate appropriate error message.

--

___
Python tracker 

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



[issue28515] Py3k warnings in Python 2.7 tests

2016-10-23 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: http://bugs.python.org/file45198/tests_py3k_warns_2.patch

___
Python tracker 

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



[issue28498] tk busy command

2016-10-23 Thread GNJ

GNJ added the comment:

http://www.gnjmotorsport.com/search-by-car/vauxhall/

--
nosy: +GNJ

___
Python tracker 

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



[issue28498] tk busy command

2016-10-23 Thread Miguel

Miguel added the comment:

Yes, sure. It will break code. Maybe it's better to be explicit than implicit 
(another Python motto). It's also necessary to change configure(). This is the 
code for my version of _configure() and configure():
def _configure(self, cmd, cnf, kw):
"""Internal function."""
if kw:
cnf = _cnfmerge((cnf, kw))
elif cnf:
cnf = _cnfmerge(cnf)
if cnf is None:
return self._getconfigure(cmd)
if isinstance(cnf, str):
return self._getconfigure1(cmd + ('-'+cnf,))
self.tk.call(cmd + self._options(cnf))


# These used to be defined in Widget:
def configure(self, cnf=None, **kw):
"""Configure resources of a widget.

The values for resources are specified as keyword
arguments. To get an overview about
the allowed keyword arguments call the method keys.
"""
return self._configure((self._w, 'configure'), cnf, kw)

The semantics of getboolean is clear for me: Transform a true and false value 
in *Tcl* to an integer value: 1 or 0:

def getboolean(s):
"""Convert true and false to integer values 1 and 0."""
return _default_root.tk.getboolean(s)

I think that the C implementation of getboolean is right. 
The true values for Tcl are: 1, true, yes. 
And the false values are: 0, false, no

>>> tk.getboolean("true")
True
>>> tk.getboolean("false")
False
>>> tk.getboolean("0")
False
>>> tk.getboolean("1")
True
>>> tk.getboolean("yes")
True
>>> tk.getboolean("no")
False

--

___
Python tracker 

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



[issue26656] Documentation for re.compile is a bit outdated

2016-10-23 Thread Sworddragon

Sworddragon added the comment:

The proposal is in the startpost.

--

___
Python tracker 

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



[issue28498] tk busy command

2016-10-23 Thread Miguel

Miguel added the comment:

It's also necessary in the same way to adapt these functions:
itemconfigure(), entryconfigure(), image_configure(), tag_configure() and 
window_configure().

--

___
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-10-23 Thread Michael Felt

Michael Felt added the comment:

re: the blake issue - I have ignored it as in not run any tests. Assistance 
would be to tell me how to easily test "blake" working or not working - before 
I head upstream.

re: _POSIX_C_SOURCE and _XOPEN_SOURCE

This is the logic in standards.h (AIX 5.3)
  +142  #if (!defined (_XOPEN_SOURCE)) &&  (!defined (_POSIX_SOURCE)) && 
(!defined (_ANSI_C_SOURCE))
  +143  #define _XOPEN_SOURCE  600
  +144  #define _XOPEN_SOURCE_EXTENDED 1
  +145  #define _POSIX_SOURCE
  +146  #ifndef _POSIX_C_SOURCE
  +147  #define _POSIX_C_SOURCE 200112L
  +148  #endif

And the same in AIX 6.1 (just different line numbers)
  +151  #if (!defined (_XOPEN_SOURCE)) &&  (!defined (_POSIX_SOURCE)) && 
(!defined (_ANSI_C_SOURCE))
  +152  #define _XOPEN_SOURCE  600
  +153  #define _XOPEN_SOURCE_EXTENDED 1
  +154  #define _POSIX_SOURCE
  +155  #ifndef _POSIX_C_SOURCE
  +156  #define _POSIX_C_SOURCE 200112L
  +157  #endif

However, AIX 7.1 has the "new" values:

  +160  #if (!defined (_XOPEN_SOURCE)) &&  (!defined (_POSIX_SOURCE)) && 
(!defined (_ANSI_C_SOURCE))
  +161  #define _XOPEN_SOURCE  700
  +162  #define _XOPEN_SOURCE_EXTENDED 1
  +163  #define _POSIX_SOURCE
  +164  #ifndef _POSIX_C_SOURCE
  +165  #define _POSIX_C_SOURCE 200809L
  +166  #endif

So, getting back to issue #17120 - and impact for AIX (and other older *nix 
platforms - is Python3 saying no support?)

As to the question about how the compiler is called ... Using, as much as 
possible - defaults documented below.

I use the invocation "xlc" generally - although I am thinking about changing to 
the "thread safe" invocation "xlc_r".

The differences are defined in /etc/vac.cfg.{53|61|71} (and I expect .72 for 
the latest compiler).

* -qlanglvl=extc99 C compiler with common extensions, UNIX headers
xlc:use= DEFLT_C
crt= /lib/crt0.o
mcrt   = /lib/mcrt0.o
gcrt   = /lib/gcrt0.o
libraries  = -L/usr/vac/lib,-lxlopt,-lxlipa,-lxl,-lc
proflibs   = -L/lib/profiled,-L/usr/lib/profiled
options= -qlanglvl=extc99,-qcpluscmt,-qkeyword=inline,-qalias=ansi


* standard c compiler aliased as xlc_r (53 Threads)
xlc_r:  use= DEFLT_C
crt= /lib/crt0.o
mcrt   = /lib/mcrt0.o
gcrt   = /lib/gcrt0.o
libraries  = -L/usr/vac/lib,-lxlopt,-lxlipa,-lxl,-lpthreads,-lc
proflibs   = -L/lib/profiled,-L/usr/lib/profiled
hdlibs = -L/usr/vac/lib,-lhmd
options= 
-qlanglvl=extc99,-qcpluscmt,-qkeyword=inline,-qalias=ansi,-qthreaded,-D_THREAD_SAFE,-D__VACPP_MULTI__

As both have -qalias=ansi - that obviously does not define any of:
 +142  #if (!defined (_XOPEN_SOURCE)) &&  (!defined (_POSIX_SOURCE)) && 
(!defined (_ANSI_C_SOURCE))

FYI: the other defaults are here:

DEFLT_C:
use   =DEFLT
xlurt_cfg_path=/usr/vac/urt
xlurt_cfg_name=urt_client.cfg

DEFLT_CPP:
use   =DEFLT
xlurt_cfg_path=/usr/vacpp/urt
xlurt_cfg_name=urt_client.cfg

DEFLT:
cppcomp   = /usr/vacpp/exe/xlCentry
ccomp = /usr/vac/exe/xlcentry
code  = /usr/vac/exe/xlCcode
cpp   = /usr/vac/exe/xlCcpp
munch = /usr/vacpp/exe/munch
dis   = /usr/vac/exe/dis
xlC   = /usr/vac/bin/xlc
list  = /usr/vac/exe/xllist
xslt  = /usr/vac/exe/XALAN
transforms = /usr/vac/listings
listlibs  = /usr/vac/lib
cppinc= /usr/vacpp/include
ipa   = /usr/vac/exe/ipa
cppfilt   = /usr/vacpp/bin/c++filt
bolt  = /usr/vac/exe/bolt
as= /bin/as
ld= /bin/ld
artool= /bin/ar
options   = 
-D_AIX,-D_AIX32,-D_AIX41,-D_AIX43,-D_AIX50,-D_AIX51,-D_AIX52,-D_AIX53,-D_IBMR2,-D_POWER
options32 = -bpT:0x1000,-bpD:0x2000
options32_bmaxdata = -bpT:0x1000,-bpD:0x3000
options64 = -bpT:0x1,-bpD:0x11000
ldopt = "b:o:e:u:R:H:Y:Z:L:T:A:k:j:"
hdlibs= -L/usr/vac/lib,-lhmd
xlCcopt   = -qlanglvl=extc99,-qcpluscmt,-qkeyword=inline,-qalias=ansi
crt_64= /lib/crt0_64.o
mcrt_64   = /lib/mcrt0_64.o
gcrt_64   = /lib/gcrt0_64.o
smplibraries = -lxlsmp
palibraries  = -L/usr/vatools/lib,-lpahooks
resexp = /usr/vacpp/lib/res.exp
genexports = /usr/vac/bin/CreateExportList
vac_path   = /usr/vac
vacpp_path = /usr/vacpp
xlcmp_path = /usr/vac:/usr/vacpp
xlc_c_stdinc   = /usr/vac/include:/usr/include
xlc_cpp_stdinc = /usr/vacpp/include:/usr/include
xlurt_msg_cat_name=vacumsg.cat
__GNUC_MINOR__ = 3
__GNUC_PATCHLEVEL__ = 4
__GNUC__ = 3
dfplibs = -ldecNumber
oslevel   = 5.3
os_variant = aix
os_major  = 5
os_minor  = 3
inst_info = 5.3, 03 10 2015 16:09

I think the key "extra" is the default defines:

[issue28115] Use argparse for the zipfile module

2016-10-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7f01d9d471e5 by Serhiy Storchaka in branch '2.7':
Issue #28115: ZIP creation test requires zlib.
https://hg.python.org/cpython/rev/7f01d9d471e5

New changeset 7701e9cb8712 by Serhiy Storchaka in branch '3.5':
Issue #28115: ZIP creation test requires zlib.
https://hg.python.org/cpython/rev/7701e9cb8712

New changeset 5b779441d03e by Serhiy Storchaka in branch '3.6':
Issue #28115: ZIP creation test requires zlib.
https://hg.python.org/cpython/rev/5b779441d03e

New changeset 3e7da46aead3 by Serhiy Storchaka in branch 'default':
Issue #28115: ZIP creation test requires zlib.
https://hg.python.org/cpython/rev/3e7da46aead3

--

___
Python tracker 

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



[issue28498] tk busy command

2016-10-23 Thread Miguel

Miguel added the comment:

Your proposal also makes an extra computation: an item (not) belongs to a list

   if not self._w in cmd:
  cmd = _flatten((self._w, cmd))

Also it's more efficient to use this than the function _flaten() in that 
situation:
   
   if not self._w in cmd:
  cmd = (self._w,) + cmd

--

___
Python tracker 

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



[issue27779] Sync-up docstrings in C version of the the decimal module

2016-10-23 Thread Stefan Krah

Stefan Krah added the comment:

Lisa, thanks for the patch.  I've left some comments -- some docstrings in the 
Python version are outdated, some not quite correct, some are not very clear 
(to me).

I don't know how to proceed. Initially I thought it would be as easy as just 
taking over all Python docstrings verbatim, but looks like there's more work 
involved.

--

___
Python tracker 

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



[issue18235] _sysconfigdata.py wrong on AIX installations

2016-10-23 Thread Michael Felt

Michael Felt added the comment:

The value that works for LDSHARED is the value that LDCXXSHARED has. 
BLDSHARED is also broken (currently).

  'BLDSHARED': './Modules/ld_so_aix xlc_r -bI:./Modules/python.exp 
-L/opt/lib',

  'LDCXXSHARED': '/opt/lib/python2.7/config/ld_so_aix xlc_r 
-bI:/opt/lib/python2.7/config/python.exp',

except neither BLDSHARED nor LDCXXSHARED have taken the extra LDFLAG 
that was exported before configure was called (in this case -L/opt/lib)

In short: LDSHARED needs to be a full path, not relative and should 
include -L flags used during the build, if any.

LDCXXSHARED should also add LDFLAGS -L entries (and perhaps, where 
relevant -R flags).

BLDSHARED does not work when "builddir" is . and source_dir is 
../src/python-X.W.Y because Modules/ld_so_aix is not in ".", but is at 
../src/python-X.X.Y/Modules/ld_so_aix

On 15-Oct-16 00:23, Martin Panter wrote:
> Martin Panter added the comment:
>
> This is my understanding:
>
> We are talking about the code at 
>  that 
> switches the values of LDSHARED and/or BLDSHARED.
>
> Yes, Michael H. was suggesting to both move and change (revert) back to 
> overwriting LDSHARED with the value of BLDSHARED. Since he is moving the code 
> into _init_posix(), which I think only gets called at run time, the state of 
> _PYTHON_BUILD won’t affect the value of LDSHARED saved in the installed 
> config file.
>
> --
>
> ___
> Python tracker 
> 
> ___

--
nosy: +aixto...@gmail.com

___
Python tracker 

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



[issue28498] tk busy command

2016-10-23 Thread klappnase

klappnase added the comment:

Your changed _configure() will also break Canvas/Listbox.itemconfigure(), 
Menu.entryconfigure() and a number of other methods, Tix is also affected. It 
will also break third party extensions that use _configure(), like pybwidget.
As another python motto says "Special cases aren't special enough to break the 
rules." :) I believe that breaking existing code is not justified by the 
"special case" of the tk_busy_configure() syntax, resp. the desire to avoid 10 
extra lines of code.

The change to _configure() I suggested otoh leaves all the existing 
configure()-like methods intact, and it seems at least very unlikely that some 
third party module uses a configure()-like method that adds the window path 
name to the cmd-tuple (which indeed would break my _configure() example.

However, following the "explicit is better than implicit" motto, I believe the 
best idea, if _configure() should be changed at all, is to add a new option to 
let the programmer decide if the window path should be added to the cmd tuple, 
which defaults to a value that keeps the old behavior intact, as in this 
example:

def _configure(self, cmd, cnf, kw, usewinpath=True):
"""Internal function."""
if kw:
cnf = _cnfmerge((cnf, kw))
elif cnf:
cnf = _cnfmerge(cnf)
if usewinpath:
cmd = _flatten((self._w, cmd))
else:
cmd = _flatten(cmd)
if cnf is None:
return self._getconfigure(cmd)
if isinstance(cnf, str):
return self._getconfigure1(cmd + ('-'+cnf,))
self.tk.call(cmd + self._options(cnf))

Then busy_configure might look like:

def busy_configure(self, cnf=None, **kw):
return self._configure(('tk', 'busy', 'configure', self._w),
cnf, kw, usewinpath=False)

--

___
Python tracker 

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



[issue18235] _sysconfigdata.py wrong on AIX installations

2016-10-23 Thread Michael Felt

Michael Felt added the comment:

correction:

On 23-Oct-16 20:54, Michael Felt wrote:
> except neither BLDSHARED nor LDCXXSHARED have taken the extra LDFLAG
except neither LDSHARED nor LDCXXSHARED have taken the extra LDFLAG
like BLDSHARED has.
> that was exported before configure was called (in this case -L/opt/lib)

--

___
Python tracker 

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



[issue28498] tk busy command

2016-10-23 Thread klappnase

klappnase added the comment:

"Also it's more efficient to use this than the function _flaten() in that 
situation:
   
   if not self._w in cmd:
  cmd = (self._w,) + cmd
"

The construct with _flatten() was not my invention, it's probably something to 
discuss with Guido ;)
The advantage of _flatten() may be, that it will also handle nested tuples 
properly, though I don't know if there is a real-life situation whee nested 
tuples might show up there. Anyway, thinking about optimisations on that level 
seems somewhat pointless to me, no one will probably iterate over configure() 
calls, and if yes, the bottleneck is clearly the self.tk.call() part.

--

___
Python tracker 

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



[issue28498] tk busy command

2016-10-23 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
Removed message: http://bugs.python.org/msg279271

___
Python tracker 

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



[issue28498] tk busy command

2016-10-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Use "hg diff" command for creating a patch.

--
stage: needs patch -> patch review
Added file: http://bugs.python.org/file45199/tk_busy.patch

___
Python tracker 

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



[issue5830] heapq item comparison problematic with sched's events

2016-10-23 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
status: closed -> open

___
Python tracker 

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



[issue28457] Make public the current private known hash functions in the C-API

2016-10-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Semantic of _PyDict_GetItem_KnownHash is not clear. Should it correspond 
PyDict_GetItem or PyDict_GetItemWithError? See issue28123.

--
dependencies: +_PyDict_GetItem_KnownHash ignores DKIX_ERROR return
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue28498] tk busy command

2016-10-23 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: http://bugs.python.org/file45200/tk_busy.patch

___
Python tracker 

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



[issue26656] Documentation for re.compile is a bit outdated

2016-10-23 Thread Matthew Barnett

Matthew Barnett added the comment:

@Sworddragon: Your post says that it should be more generic or complete the 
list, but it doesn't make a suggestion as to what it should _actually_ say.

Example: "Compile a regular expression pattern into a regular expression 
object, which can be used for matching and replacing using the methods 
described below."

--

___
Python tracker 

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



[issue28514] Python (IDLE?) freezes on file save on Windows

2016-10-23 Thread SilentGhost

Changes by SilentGhost :


--
status: open -> pending

___
Python tracker 

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



[issue28498] tk busy command

2016-10-23 Thread Miguel

Miguel added the comment:

This is my point of view:
These functions are easy to change: 
itemconfigure(), entryconfigure(), image_configure(), tag_configure() and 
window_configure()

It's only to add self._w in the proper place. Only one line per method

Other third party extensions should not rely on _configure() because it's an 
internal method (it starts with underscore). We have rights to change the 
semantics of this internal method in any moment without notification.

--
components: +Installation -Library (Lib), Tkinter

___
Python tracker 

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



[issue28498] tk busy command

2016-10-23 Thread Miguel

Miguel added the comment:

Hi Serhiy,
I totally disagree of this change on your patch:

+def tk_busy_status(self):
+'''Returns the busy status of this window.
+If the window presently can not receive user interactions,
+True is returned, otherwise False.'''
+return((self.tk.getboolean(self.tk.call(
+'tk', 'busy', 'status', self._w)) and True) or False)

tk_busy_status should return the returned value of self.tk.getboolean directly 
like other methods in Tkinter using self.tk.getboolean.

There is no test that shows that self.tk.getboolean is buggy.

This is the right implementation:
def tk_busy_status(self):
 '''Returns the busy status of this window.
If the window presently can not receive user interactions,
True is returned, otherwise False.'''
return self.tk.getboolean(self.tk.call('tk', 'busy', 'status', self._w))

--

___
Python tracker 

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



[issue26388] Disabling changing sys.argv[0] with runpy.run_module(...alter_sys=True)

2016-10-23 Thread Mike Kaplinskiy

Mike Kaplinskiy added the comment:

Hey Nick,

Sorry for the long delay. Unfortunately Python isn't my main work language 
anymore so working on this has proved to be quite a context switch. I'm going 
to try to finish this up now.

The attached patch implements a new pattern for wrapping runpy - one that I 
hope is a bit more general than just setting argv. In particular, using the new 
load_module/load_path doesn't automatically change argv at all when calling 
run. The callers can do pretty much whatever they want before calling run().

>From a docs perspective this is quite a bit easies to understand. You call 
>runpy.load_* to find the module, change whatever you want: globals/module dict 
>values/names/etc, and call .run(). We would even expose a convenient `with 
>runpy.ModifiedArgv(argv):` to help with the argv swapping. "Simple" use-cases 
>can continue to use runpy.run_* without needing to get into the save/restore 
>we do here.

Let me know what you think of this approach and I can flesh out the docs around 
it. Otherwise, I'm more than happy to implement the callback approach you 
suggested.

Thanks,
Mike.

--
Added file: http://bugs.python.org/file45201/patch-2.diff

___
Python tracker 

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



[issue28498] tk busy command

2016-10-23 Thread klappnase

klappnase added the comment:

"This is my point of view:
These functions are easy to change: 
itemconfigure(), entryconfigure(), image_configure(), tag_configure() and 
window_configure()

It's only to add self._w in the proper place. Only one line per method"

At least Tix would have to be changed, too.

"Other third party extensions should not rely on _configure() because it's an 
internal method (it starts with underscore). We have rights to change the 
semantics of this internal method in any moment without notification."

But why insist on your rights, if there is no actual need to do this? The 
function I posted in my previous message for example serves the same purpose 
without having to change any other function call and without breaking any 
third-party code that possibly uses _configure(). 
You sure have the right to do this, but I feel it is at least somewhat 
unfriendly if it is done without necessity.

Besides, one thing I missed in my last post:
"Also it's more efficient to use this than the function _flaten() in that 
situation:
   
   if not self._w in cmd:
  cmd = (self._w,) + cmd
"
If you want to discard the use of _flatten() you would also have to change 
Misc.configure() .

--
components: +Library (Lib), Tkinter -Installation

___
Python tracker 

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



[issue28498] tk busy command

2016-10-23 Thread klappnase

klappnase added the comment:

And another thing:

"There is no test that shows that self.tk.getboolean is buggy."

Well...

$ python3
Python 3.4.2 (default, Oct  8 2014, 10:45:20) 
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>> root=tkinter.Tk()
>>> root.tk.getboolean(root.tk_strictMotif())
0
>>>

--

___
Python tracker 

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



[issue28498] tk busy command

2016-10-23 Thread Miguel

Miguel added the comment:

Yes, its true. The semantics of configure() is affected then if I ommit _flaten.

I like elegancy and to dont repeat myself for this reason I made that 
suggestion. But the drawback is that maybe other external code that shouldn't 
rely on internal methods like _configure, would be affected.

I think that you agree with me about the fact there is no bug with getboolean 
and it has the expected behaviour.

--

___
Python tracker 

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



[issue28498] tk busy command

2016-10-23 Thread Miguel

Miguel added the comment:

Hi,
I think that it's behaving well. Where is the bug here?
root.tk.getboolean(root.tk_strictMotif())

getboolean() converts Tcl strings to Boolean Python values according to the 
definition of True and False in Tcl.

getboolean is only used for converting strings to boolean Python values. It's 
undefined the behaviour for other things different than strings.

--

___
Python tracker 

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



[issue28498] tk busy command

2016-10-23 Thread Miguel

Miguel added the comment:

It's not defined the semantics for things different than strings.

--

___
Python tracker 

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



[issue28498] tk busy command

2016-10-23 Thread klappnase

klappnase added the comment:

The bug is that tk_strictMotif (which uses self.tk.getboolean() itself) returns 
0 instead of False. I used the "nested" command to point out, that 
self.tk.getboolean() is broken when used with wantobjects=True, because it does 
*not* return proper boolean values , i.e. True or False. It is probably the 
reduction to handling strings only that you mentioned that causes this wrong 
behavior, because with wantobjects=True self.tk.call() will convert the "0" 
tk_strictMotif returns into 0 which is not handled properly. With 
wantobjects=False, it will retunr True/False as expected. Its behavior is not 
consistent, *that* is the bug.

But to be honest, personally I don't give a dime if these calls return 
True/False or 1/0, I just wanted to make clear why I explicitely converted the 
output of self.tk.getboolean() in my tk_busy_status function. I believed that 
proper boolean values (True/False) were the desired thing.
I personally agree with you about the busy_status function, my construct is not 
necessary, if someone does not like it to return 0/1 , tkapp.getboolean() 
should be fixed instead.
And again I admit that I don't remember why I used that construct instead of 
just passing the result to bool(). I am quite sure I had a reason for this when 
I started to use this construct first some years ago, but back then 
tkapp.getboolean() behaved differently (and worse), some of which was 
apparently fixed in the meantime.

And one more time about _configure():

"I like elegancy..."

So do I, but can't expanding the functionality of a method by adding a new 
option be considered a more elegant solution than entirely changing its 
behavior with the effect of having to change a number of other things, too? 
(though I admit that the name for this option I picked first should seriously 
be reconsidered if it's supposed to be called "elegant", I confess that I am 
notoriously dumb in inventing names :)

--

___
Python tracker 

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



[issue28498] tk busy command

2016-10-23 Thread Miguel

Miguel added the comment:

In the C source code that I am reading of tkinter: _tkinter.c. It seems that 
these parameters are not used:
- wantobjects
- useTk
- syn 
- use

It seems that it's dead code. I hope that somebody can tell me whether I am 
right. I suppose that now Python returns always Python objects instead of 
strings. For this reason, wantobjects is not any more necessary. This is the C 
code of Tkinter_Create that I am reading:

static PyObject *
Tkinter_Create (self, args)
 PyObject *self;
 PyObject *args;
{
  char *screenName = NULL;
  char *baseName = NULL;
  char *className = NULL;
  int interactive = 0;

  baseName = strrchr (Py_GetProgramName (), '/');
  if (baseName != NULL)
baseName++;
  else
baseName = Py_GetProgramName ();
  className = "Tk";
  
  if (!PyArg_ParseTuple (args, "|zssi",
 &screenName, &baseName, &className, &interactive))
return NULL;

  return (PyObject *) Tkapp_New (screenName, baseName, className, 
 interactive);
}

And this is the call to Tkinter_Create in Tkinter.py:
   self.tk = _tkinter.create(screenName, baseName, className, interactive, 
wantobjects, useTk, sync, use)

--

___
Python tracker 

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



[issue28516] contextlib.ExitStack.__enter__ has trivial but undocumented behavior

2016-10-23 Thread Walker Hale IV

New submission from Walker Hale IV:

contextlib.ExitStack implies but does not explicitly state that its __enter__ 
method trivially returns self.

This means that if a user invokes pop_all and then uses the resulting ExitStack 
instance in a with statement, the user will be relying on undocumented 
behavior. Avoiding undocumented behavior forces the user to instead use a 
tedious try/finally construct, partially defeating the elegance of context 
managers.

I propose that:

1. The ExitStack.__enter__ method be briefly mentioned as doing nothing besides 
returning self.

2. The example in pop_all documentation be expanded to show a following with 
statement that uses the new ExitStack instance.

The discussion in section 29.6.3.2 is not sufficient to make this trivial point 
clear.

--
messages: 279296
nosy: Walker Hale IV
priority: normal
severity: normal
status: open
title: contextlib.ExitStack.__enter__ has trivial but undocumented behavior
versions: 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



[issue28517] Dead code in wordcode

2016-10-23 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

>>> def func(test):
... if test == 1:
... return 1
... elif test == 2:
... return 2
... return 3
... 
>>> import dis
>>> dis.dis(func)

Python 3.5:

  2   0 LOAD_FAST0 (test)
  3 LOAD_CONST   1 (1)
  6 COMPARE_OP   2 (==)
  9 POP_JUMP_IF_FALSE   16

  3  12 LOAD_CONST   1 (1)
 15 RETURN_VALUE

  4 >>   16 LOAD_FAST0 (test)
 19 LOAD_CONST   2 (2)
 22 COMPARE_OP   2 (==)
 25 POP_JUMP_IF_FALSE   32

  5  28 LOAD_CONST   2 (2)
 31 RETURN_VALUE

  6 >>   32 LOAD_CONST   3 (3)
 35 RETURN_VALUE

Python 3.6:

  2   0 LOAD_FAST0 (test)
  2 LOAD_CONST   1 (1)
  4 COMPARE_OP   2 (==)
  6 POP_JUMP_IF_FALSE   14

  3   8 LOAD_CONST   1 (1)
 10 RETURN_VALUE
 12 JUMP_FORWARD12 (to 26)

  4 >>   14 LOAD_FAST0 (test)
 16 LOAD_CONST   2 (2)
 18 COMPARE_OP   2 (==)
 20 POP_JUMP_IF_FALSE   26

  5  22 LOAD_CONST   2 (2)
 24 RETURN_VALUE

  6 >>   26 LOAD_CONST   3 (3)
 28 RETURN_VALUE

Note JUMP_FORWARD after RETURN_VALUE in 3.6 listing.

--
components: Interpreter Core
messages: 279297
nosy: Demur Rumed, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Dead code in wordcode
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