[issue11734] Add half-float (16-bit) support to struct module

2016-08-29 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> mark.dickinson

___
Python tracker 

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



[issue11734] Add half-float (16-bit) support to struct module

2016-08-29 Thread Raymond Hettinger

Raymond Hettinger added the comment:

In the docs for note 7, consider expanding the text to describe what a 
half-float is (1-bit sign, 10 bit significand, 5 bit exponent) and its 
allowable range.  This wasn't necessary for codes "f" and "d" since they have 
well-known C equivalents, but in this case some elaboration is needed.  Also 
consider  including a link to the wikipedia article and perhaps to IEEE 
754-2008.

Otherwise, he patch looks complete and passes the test suite.  I think it is 
ready to apply.

--
nosy: +rhettinger

___
Python tracker 

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



[issue27879] add os.syncfs()

2016-08-29 Thread Марк Коренберг

Марк Коренберг added the comment:

1. It is appropriate to call `sync()` when one calls `os.syncfs()` if 
`syncfs()` syscall is not supported in kernel.
2. https://technet.microsoft.com/sv-se/sysinternals/bb897438(en-us).aspx
3. https://github.com/EricGrange/FlushFileCache ?

--

___
Python tracker 

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



[issue21541] Provide configure option --with-ssl for compilation with custom openssl

2016-08-29 Thread Gregory P. Smith

Gregory P. Smith added the comment:

We use Modules/Setup.local to build the _ssl and _hashlib modules against our 
an SSL library of our choosing at work using a Setup entry like this:

_ssl _ssl.c $(PY_CORE_CFLAGS) -DUSE_SSL -I%{SSL_ROOT}/include \
-Wl,--version-script,_ssl.lds \
-Wl,-Bsymbolic \
%{SSL_ROOT}/libssl.a %{SSL_ROOT}/libcrypto.a

%{SSL_ROOT} is replaced prior to building using sed to drop in the path to our 
desired libssl build.

_ssl.lds is a linker script to hide all but the module init function as we are 
linking statically.

MODULE__ssl {
  global: PyInit__ssl;
  local: *;
};


(all that said, I still see how a configure flag would be nicer for many people 
even though the existing patch does not look like it would work for our own 
static linking needs - one reason we do that being to avoid dynamic versioning 
issues)

--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue21541] Provide configure option --with-ssl for compilation with custom openssl

2016-08-29 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
versions: +Python 3.6 -Python 3.4

___
Python tracker 

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



[issue24254] Make class definition namespace ordered by default

2016-08-29 Thread Nick Coghlan

Nick Coghlan added the comment:

Because we're not making ordered-by-default dicts a language specification 
level requirement, so portable code can't rely on them.

However, the PEP at https://www.python.org/dev/peps/pep-0520/ is deliberately 
worded so that there's no requirement for the class body execution namespace to 
specifically be collections.OrderedDict - it just needs to be order preserving 
so that __definition_order__ can be populated.

If someone reviews and merges the compact ordered dict patch, then this patch 
can likely be made a lot simpler.

--

___
Python tracker 

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



[issue27891] Consistently group and sort imports within idlelib modules.

2016-08-29 Thread Terry J. Reedy

Terry J. Reedy added the comment:

On 2002 Sept 14, the following was merged into editor.py (then EditorWindow.py) 
as part of the smart indenting code added to the bottom.

import tokenize
_tokenize
del tokenize

This now would usually be written "import tokenize as _tokenize".  Stdlib 
modules without explicit __all__ often do this to omit stdlib modules from 
their public interface.  Idlelib does not do this.  Add to README import 
standards.  I put replaced the above with 'import tokenize' as the top where is 
belongs and changed all '_tokenize' to 'tokenize'.

--

___
Python tracker 

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



[issue27892] Idlelib: document or move delayed imports

2016-08-29 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Another good reason for delaying an import is when the import is only needed 
for testing.

In module_x
...
def callable_x(parent)  # htest #
from tkinter import Toplevel
box = Toplevel(parent)
...
if __name__ == '__main__':
from unittest import main
main('idlelib.idle_test.test_module_x', verbosity=2)

from idlelib.idle_test.htest import run
run(callable_x)

This should be part of 'Import Standards' in idlelib.README.

--

___
Python tracker 

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



[issue27891] Consistently group and sort imports within idlelib modules.

2016-08-29 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This issue includes adding the idlelib import coding standard to idlelib.README.

The delayed-import issue is #27893.

A second followup will be to stop importing tkinter modules 'as' their Py 2 
names.  Change "from tkinter import font as TkFont" to "from tkinter import 
font" and globally replace 'TkFont' with 'tkfont'.  Do the same for messagebox 
and any other submodules as needed.

--

___
Python tracker 

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



[issue27889] ctypes interfers with signal handling

2016-08-29 Thread Andre Merzky

Andre Merzky added the comment:

Thanks for checking!  I use:

$ uname -a
Linux thinkie 3.11-2-amd64 #1 SMP Debian 3.11.8-1 (2013-11-13) x86_64 GNU/Linux

$ python -V
Python 2.7.5+


Note that the problem does not occur on every run -- but in more than 50% of 
the cases, for me.  I am on a somewhat old machine right now (M620), not sure 
if that matters, and will try to reproduce on some other boxes tomorrow.

--

___
Python tracker 

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



[issue27892] Idlelib: document or move delayed imports

2016-08-29 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
dependencies: +Consistently group and sort imports within idlelib modules.

___
Python tracker 

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



[issue27892] Idlelib: document or move delayed imports

2016-08-29 Thread Terry J. Reedy

New submission from Terry J. Reedy:

This issue depends and follows-up on #27891, consistently grouping and sorting 
imports in idlelib files.

PEP 8 (also) says 'all imports are put at the top of the file', though the 
'consistency hobgloblin' rule allows for exceptions.  Possible reasons include 
making circular imports work, delaying side-effects, and significantly reducing 
initial import time of the containing module.   All are rare.

Idlelib currently has numerous exceptions, only a few of which have a 
documented reason.  The others might have a good reason, but may be holdovers 
from when 'import at top' was absent or not observed.  I propose to at least 
document the exceptions by putting comments at the top, in their sort location 
among other idlelib imports.  Examples: 

# from idlelib import module  # in EditorWindow
# from idlelib.other import SomeClass  # in EditorWindow

Doing this will make it possible to see at a glance all the idlelib imports in 
a module.

I will remove at least one redundant delayed import and move some when I am 
sure there is no reason not to.  I may ask original authors as to their reason 
for placing imports where they did.

Moving 'import X' from a function is easy and safe.  Moving an import from a 
class requires deleting 'self.' from all references, so is not safe without 
extra care.  At least for EditorWindow, I may leave this to when editing the 
class anyway.

--
assignee: terry.reedy
components: IDLE
messages: 273893
nosy: terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: Idlelib: document or move delayed imports
type: enhancement
versions: Python 3.6

___
Python tracker 

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



[issue27891] Consistently group and sort imports within idlelib modules.

2016-08-29 Thread Terry J. Reedy

New submission from Terry J. Reedy:

PEP 8 suggests separately grouping stdlib, dependency, and local package 
imports.  Within idlelib, idlelib imports are treated as local package imports. 
 Tkinter is sometimes treated as a dependency, which makes its imports easy to 
notice, and I want to do this consistently.  It is conventional to sort imports 
within each group.  This is sometimes true now, sometimes not (even before the 
3.6 renaming).

The possible danger of rearranging imports is that a line gets deleted and not 
pasted.  Rietveld's side-by-side diff should make this easy to detect.

This issue is about re-arranging the imports currently at the top of a file, 
and any module level imports that I notice elsewhere.  Dealing with delayed 
imports within functions and classed will be another issue, which will depend 
on this one.

--
assignee: terry.reedy
components: IDLE
messages: 273892
nosy: terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: Consistently group and sort imports within idlelib modules.
type: enhancement
versions: Python 3.6

___
Python tracker 

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



[issue27350] Compact and ordered dict

2016-08-29 Thread INADA Naoki

Changes by INADA Naoki :


Added file: https://bugs.python.org/file44259/compact-dict.patch

___
Python tracker 

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



[issue27889] ctypes interfers with signal handling

2016-08-29 Thread Eryk Sun

Eryk Sun added the comment:

I can't reproduce this issue in 2.7.11 on Linux. I also don't see how it could 
be related to ctypes. It doesn't meddle with signal handlers, and neither does 
Linux libuuid -- not as far I as I can tell with breakpoints set on signal() 
and sigaction(). Please provide the Python version and platform that you're 
using.

--
nosy: +eryksun

___
Python tracker 

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



[issue27890] platform.release() incorrect in Python 3.5.2 on Windows 2008ServerR2

2016-08-29 Thread James Domingo

New submission from James Domingo:

The platform.release() function in Python 3.5.1 returns the correct value on 
Windows 2008 Server R2:

  C:\Users\jdoe\Documents\Python>python-3.5.1-embed-amd64\python.exe
  Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:54:25) [MSC v.1900 64 bit 
(AM
  D64)] on win32
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import platform
  >>> platform.release()
  '2008ServerR2'

However, the function in the latest release, Python 3.5.2, misidentifies the 
system as Windows 7:

  C:\Users\jdoe\Documents\Python>python-3.5.2-embed-amd64\python.exe
  Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit 
(AM
  D64)] on win32
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import platform
  >>> platform.release()
  '7'

--
components: Library (Lib)
messages: 273890
nosy: James Domingo
priority: normal
severity: normal
status: open
title: platform.release() incorrect in Python 3.5.2 on Windows 2008ServerR2
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



[issue27889] ctypes interfers with signal handling

2016-08-29 Thread Andre Merzky

New submission from Andre Merzky:

Summary:  A thread uses signals to the MainThread to signal an abnormal 
condition.  The main thread is expected to get that signal, invoke the signal 
handler, and raise an exception.  In combination with 'ctypes' calls, that does 
not happen.


Consider the following code:


#!/usr/bin/env python

import multiprocessing as mp
import threading   as mt
import signal
import time
import os

# from uuid.py line 400
import ctypes, ctypes.util
lib = ctypes.CDLL(ctypes.util.find_library('uuid'))

def sigusr2_handler(signum, frame):
raise RuntimeError('caught sigusr2')
signal.signal(signal.SIGUSR2, sigusr2_handler)

def sub(pid):
time.sleep(1)
os.kill(pid, signal.SIGUSR2)

try:
  # p = mp.Process(target=sub, args=[os.getpid()])
  # p.start()
t = mt.Thread(target=sub, args=[os.getpid()])
t.start()
time.sleep(3)
except Exception as e:
print 'except: %s' % e
else:
print 'unexcepted'
finally:
  # p.join()
t.join()


With Python 2.7 I would expect the output:

except: caught sigusr2


but I get:

Traceback (most recent call last):
  File "./bug.py", line 29, in 
print 'unexcepted'
  File "./bug.py", line 13, in sigusr2_handler
raise RuntimeError('caught sigusr2')
  File "./bug.py", line 29, in 
print 'unexcepted'
  File "./bug.py", line 13, in sigusr2_handler
raise RuntimeError('caught sigusr2')
RuntimeError: caught sigusr2



most of the time.  The problem only happens when the 'ctypes.CDLL' line is 
enabled -- commenting it out results in the expected behavior.  That line is 
copied from uuid.py -- importing uuid.py triggers the same unexpected behavior, 
which is ultimately why I am stuck.

Note that the problem only occurs when a *thread* sends the signal -- it does 
*not* happen if the signal is sent by the main thread or by a different process 
(switch to the multiprocessing code path for confirmation).

Interestingly, the problem also disappears when a 'print' statement is added 
after the 'time.sleep(3)', which may (or may not) indicate a timing issue.

I would welcome any suggestion on how to further triage this.

--
components: ctypes
messages: 273889
nosy: Andre Merzky
priority: normal
severity: normal
status: open
title: ctypes interfers with signal handling
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



[issue27879] add os.syncfs()

2016-08-29 Thread Josh Rosenberg

Josh Rosenberg added the comment:

So syncfs is basically "sync, but only for a single file system corresponding 
to a given open file"? Given it's Linux only (doesn't look like it's part of 
any standard that UNIX or BSD OSes would provide), it seems rather special 
purpose to expose in Python. Is there some equivalent API for UNIX/BSD variants 
that `syncfs` could use to provide a single API that works on at least all 
UNIX-like systems? If not, it seems like this is an optimization that doesn't 
generalize; is it worth providing it instead of just having users call os.sync 
and accepting the cost of syncing other file systems?

--
nosy: +josh.r

___
Python tracker 

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



[issue1602] windows console doesn't print or input Unicode

2016-08-29 Thread Christopher Gurnee

Changes by Christopher Gurnee :


--
nosy: +gurnec

___
Python tracker 

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



[issue24254] Make class definition namespace ordered by default

2016-08-29 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +fijall

___
Python tracker 

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



[issue24254] Make class definition namespace ordered by default

2016-08-29 Thread STINNER Victor

STINNER Victor added the comment:

Brett Cannon added the comment:
> Any update on this? b1 is exactly 2 weeks away at this point.

Why do we need changes specific to classes, if dictionaries could be ordered by 
default?

Issue #27350: "Compact and ordered dict" by INADA Naoki

--

___
Python tracker 

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



[issue27888] Hide pip install/uninstall windows in setup

2016-08-29 Thread Steve Dower

Steve Dower added the comment:

An almost immediate update - this patch also makes COMPILEALL not pop up a 
window.

--
Added file: https://bugs.python.org/file44258/installer_2.diff

___
Python tracker 

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



[issue26470] Make OpenSSL module compatible with OpenSSL 1.1.0

2016-08-29 Thread Christian Heimes

Christian Heimes added the comment:

Awesome! I have removed the surplus functions, made the other additional 
functions static and fixed minor test issue with LibreSSL and OpenSSL < 1.0.1. 
My branches on github compile and pass all tests with OpenSSL "0.9.8zc", 
"0.9.8zh", "1.0.1t", "1.0.2", "1.0.2h", "1.1.0" and LibreSSL "2.3.0", "2.4.2" 
on Linux X86_86. I'm using my script https://github.com/tiran/multissl for 
testing.

--

___
Python tracker 

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



[issue27888] Hide pip install/uninstall windows in setup

2016-08-29 Thread Steve Dower

New submission from Steve Dower:

The console window for pip that appears during setup prevents us from having a 
truly silent install.

This patch uses the CAQuietExec task from WiX, extracted and checked in 
directly (the binary blob is omitted from the patch), to run the pip 
install/uninstall.

It also makes the task non-vital, which will prevent uninstall from failing 
when pip cannot be removed.

--
assignee: steve.dower
components: Windows
files: installer_1.diff
keywords: patch
messages: 273884
nosy: paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: patch review
status: open
title: Hide pip install/uninstall windows in setup
type: behavior
versions: Python 2.7
Added file: https://bugs.python.org/file44257/installer_1.diff

___
Python tracker 

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



[issue26470] Make OpenSSL module compatible with OpenSSL 1.1.0

2016-08-29 Thread Zachary Ware

Zachary Ware added the comment:

Looks like that took care of it, build succeeded with no new warnings, and 
test.ssltests passed.

--

___
Python tracker 

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



[issue26470] Make OpenSSL module compatible with OpenSSL 1.1.0

2016-08-29 Thread Christian Heimes

Christian Heimes added the comment:

Hi Zachary, you have found a bug in my patch. I mistakenly defined 
SSL_CTX_set_default_passwd_cb() and SSL_CTX_set_default_passwd_cb_userdata() 
for OpenSSL < 1.1.0. Both functions already exist. Only the getters are missing 
for < 1.1.0. Please remove both functions from _ssl.c and try again.

--

___
Python tracker 

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



[issue24254] Make class definition namespace ordered by default

2016-08-29 Thread Brett Cannon

Brett Cannon added the comment:

Any update on this? b1 is exactly 2 weeks away at this point.

--
nosy: +brett.cannon

___
Python tracker 

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



[issue26470] Make OpenSSL module compatible with OpenSSL 1.1.0

2016-08-29 Thread Zachary Ware

Zachary Ware added the comment:

This will require significant updates to PCbuild/prepare_ssl.py and/or the way 
we build OpenSSL on Windows before we can even properly test this on Windows.  
I don't think that should hold up acceptance of the rest of the patch (provided 
1.0.2 support remains intact), but will need to be handled eventually.

Building on Windows with 1.0.2h is broken with the current patch, but I don't 
understand things well enough to diagnose it:

ssleay.lib(ssl_lib.obj) : error LNK2005: 
_SSL_CTX_set_default_passwd_cb_userdata already defined in _ssl.obj 
[P:\ath\to\cpython\PCbuild\_ssl.vcxproj]

  
ssleay.lib(ssl_lib.obj) : error LNK2005: _SSL_CTX_set_default_passwd_cb already 
defined in _ssl.obj [P:\ath\to\cpython\PCbuild\_ssl.vcxproj]

--

___
Python tracker 

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



[issue27427] Add new math module tests

2016-08-29 Thread Mark Dickinson

Changes by Mark Dickinson :


--
assignee:  -> mark.dickinson

___
Python tracker 

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



[issue27870] Left shift of zero allocates memory

2016-08-29 Thread Mark Dickinson

Mark Dickinson added the comment:

Fixed for 2.7 and 3.6. Closing.

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



[issue27870] Left shift of zero allocates memory

2016-08-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 58ea646ef657 by Mark Dickinson in branch '2.7':
Issue #27870: A left shift of zero by a large integer no longer attempts to 
allocate large amounts of memory.
https://hg.python.org/cpython/rev/58ea646ef657

--

___
Python tracker 

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



[issue27870] Left shift of zero allocates memory

2016-08-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 09fa42818cf8 by Mark Dickinson in branch 'default':
Issue #27870: A left shift of zero by a large integer no longer attempts to 
allocate large amounts of memory.
https://hg.python.org/cpython/rev/09fa42818cf8

--
nosy: +python-dev

___
Python tracker 

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



[issue23968] rename the platform directory from plat-$(MACHDEP) to plat-$(PLATFORM_TRIPLET)

2016-08-29 Thread Matthias Klose

Matthias Klose added the comment:

now fixed.

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



[issue23968] rename the platform directory from plat-$(MACHDEP) to plat-$(PLATFORM_TRIPLET)

2016-08-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5c77488830bc by doko in branch 'default':
- Issue #23968, keep platform_triplet and multiarch macros in sync
https://hg.python.org/cpython/rev/5c77488830bc

--

___
Python tracker 

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



[issue26040] Improve coverage and rigour of test.test_math

2016-08-29 Thread Jeff Allen

Jeff Allen added the comment:

Ah, cunning: I can make sense of it in hex.

>>> hex(to_ulps(expected))
'0x3ff0'
>>> hex(to_ulps(got))
'0x3fec'
>>> hex( to_ulps(got) - to_ulps(expected) )
'-0x4'

... and what you've done with ulp then follows.

In my version a format like "{:d} ulps" was a bad idea when the error was a 
gross one, but your to_ulps is only piece-wise linear -- large differences are 
compressed.

I'm pleased my work has mostly survived: here's hoping the house build-bots 
agree. erfc() is perhaps the last worry, but math & cmath  pass on my machine.

--

___
Python tracker 

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



[issue27870] Left shift of zero allocates memory

2016-08-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM.

--
stage:  -> commit review

___
Python tracker 

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



[issue26040] Improve coverage and rigour of test.test_math

2016-08-29 Thread Jeff Allen

Jeff Allen added the comment:

Mark: Thanks for doing my homework. Points 1 and 3 I can readily agree with. I 
must take another look at to_ulps() with your patch on locally. I used the 
approach I did because I thought it was incorrect in exactly those corners 
where you prefer it. I'll take a closer look.

--

___
Python tracker 

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



[issue27882] Python docs on 9.2 Math module lists math.log2 as function but it does not exist

2016-08-29 Thread Mark Dickinson

Mark Dickinson added the comment:

Closing. The docs are correct for the corresponding version of Python: 
math.log2 is new in Python 3.3, and the entry for math.log2 is there in Python 
3.3 but not Python 3.2 or Python 2.7.

@PyRW: It looks as though this is simply a version mismatch (looking at the 
wrong docs for the Python version you're using). If you double check 
`sys.version` and find that math.log2 still appears to be missing even on 
Python >= 3.3, feel free to reopen this issue with more information.

--
nosy: +mark.dickinson
resolution:  -> not a bug
stage:  -> 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



[issue11734] Add half-float (16-bit) support to struct module

2016-08-29 Thread Mark Dickinson

Changes by Mark Dickinson :


--
assignee: mark.dickinson -> 

___
Python tracker 

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



[issue25402] More accurate estimation of the number of digits in int to decimal string conversion

2016-08-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1902e1d79e25 by Mark Dickinson in branch 'default':
Issue #25402: in int-to-decimal-string conversion, reduce intermediate storage 
requirements and relax restriction on converting large integers. Patch by 
Serhiy Storchaka.
https://hg.python.org/cpython/rev/1902e1d79e25

--
nosy: +python-dev

___
Python tracker 

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



[issue25402] More accurate estimation of the number of digits in int to decimal string conversion

2016-08-29 Thread Mark Dickinson

Mark Dickinson added the comment:

Patch and analysis LGTM. Thanks!

--
assignee:  -> mark.dickinson
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



[issue27803] ctypes automatic byref failing on custom classes attributes

2016-08-29 Thread Erwan Le Pape

Erwan Le Pape added the comment:

I can confirm Eryk got what I meant. I didn't know if it was meant to work that 
way or if it was simply something that was overlooked so I thought I'd ask, I 
will look into the ctypes code to provide a patch sometime this week if I can.

Terry, for a working example take the following (on a MS Windows):
>>> from ctypes import *
>>> from ctypes.wintypes import *
>>>
>>> class CustomPHKEY(object):
... def __init__(self, value):
... self._as_parameter_ = HKEY(value)
...
>>>
>>> function = ctypes.windll.advapi32.RegOpenKeyExW
>>> function.argtypes = [HKEY, c_wchar_p, DWORD, DWORD, POINTER(HKEY)]
>>> function.restype = LONG
>>> result = CustomPHKEY(0)
>>> function(0x8002, 'SOFTWARE', 0, 0x20019, result)
Traceback (most recent call last):
  File "", line 1, in 
ctypes.ArgumentError: argument 5: : expected 
LP_c_void_p instance instead of c_void_p

--

___
Python tracker 

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



[issue27214] a potential future bug and an optimization that mostly undermines performance in long_invert

2016-08-29 Thread Oren Milman

Oren Milman added the comment:

Thanks for the review, Mark :)

--

___
Python tracker 

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



[issue27214] a potential future bug and an optimization that mostly undermines performance in long_invert

2016-08-29 Thread Mark Dickinson

Mark Dickinson added the comment:

Agreed with the analysis and proposed solution. Thanks!

--
assignee:  -> mark.dickinson
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



[issue27214] a potential future bug and an optimization that mostly undermines performance in long_invert

2016-08-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6e1d38674b17 by Mark Dickinson in branch 'default':
Issue #27214: Fix potential bug and remove useless optimization in long_invert. 
Thanks Oren Milman.
https://hg.python.org/cpython/rev/6e1d38674b17

--
nosy: +python-dev

___
Python tracker 

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



[issue27877] Add recipe for "valueless" Enums to docs

2016-08-29 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee: docs@python -> ethan.furman

___
Python tracker 

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



[issue27444] Python doesn't build due to test_float.py broken on non-IEEE machines

2016-08-29 Thread Mark Dickinson

Changes by Mark Dickinson :


--
stage:  -> resolved

___
Python tracker 

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



[issue27444] Python doesn't build due to test_float.py broken on non-IEEE machines

2016-08-29 Thread Mark Dickinson

Mark Dickinson added the comment:

In the absence of a concrete use-case, I'm closing as "wont fix". Without 
suitable infrastructure (non-IEEE 754 buildbots, for example) and a clear need 
for this, the effort involved in maintaining CPython on non-IEEE 754 systems 
far outweighs the benefits.

--
assignee:  -> mark.dickinson
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue27870] Left shift of zero allocates memory

2016-08-29 Thread Mark Dickinson

Mark Dickinson added the comment:

Updated patch, breaking out the implementation-specific tests into their own 
method. (Thanks, Serhiy!)

--
Added file: https://bugs.python.org/file44256/lshift_zero_v2.patch

___
Python tracker 

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



[issue27870] Left shift of zero allocates memory

2016-08-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue27870] Left shift of zero allocates memory

2016-08-29 Thread Mark Dickinson

Mark Dickinson added the comment:

Here's a patch against 3.6. I think this probably shouldn't be changed for 3.5, 
but it may be worth backporting the fix to 2.7.

--
keywords: +patch
Added file: https://bugs.python.org/file44255/lshift_zero.patch

___
Python tracker 

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



[issue27870] Left shift of zero allocates memory

2016-08-29 Thread Mark Dickinson

Mark Dickinson added the comment:

Also applies to 3.x. Working on a fix.

--
assignee:  -> mark.dickinson
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



[issue27818] Speed up number format spec parsing

2016-08-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9bddf9e72c96 by Serhiy Storchaka in branch 'default':
Issue #27818: Speed up parsing width and precision in format() strings for
https://hg.python.org/cpython/rev/9bddf9e72c96

--
nosy: +python-dev

___
Python tracker 

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



[issue23229] add inf, nan, infj, nanj to cmath module

2016-08-29 Thread Mark Dickinson

Changes by Mark Dickinson :


--
status: open -> closed

___
Python tracker 

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



[issue23229] add inf, nan, infj, nanj to cmath module

2016-08-29 Thread Mark Dickinson

Changes by Mark Dickinson :


--
resolution:  -> fixed
stage: commit review -> resolved

___
Python tracker 

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



[issue23229] add inf, nan, infj, nanj to cmath module

2016-08-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4b25da63d1d0 by Mark Dickinson in branch 'default':
Issue 23229: add cmath.inf, cmath.nan, cmath.infj and cmath.nanj.
https://hg.python.org/cpython/rev/4b25da63d1d0

--
nosy: +python-dev

___
Python tracker 

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



[issue27818] Speed up number format spec parsing

2016-08-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I haven't found my old patch and tried to reimplement it. Added new file in 
stringlib. The original patch speeds up microbenchmarks only on about 4% on my 
computer (32-bit Linux). This is small, but the patch is simple. Moving some 
functions to template file adds yet about 2%. This is too small for adding new 
file. Thus I'll commit the original patch, with small style changes.

--

___
Python tracker 

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



[issue26040] Improve coverage and rigour of test.test_math

2016-08-29 Thread Mark Dickinson

Mark Dickinson added the comment:

One more version; increased the default ulp_tol to 5 everywhere, and made some 
minor style fixes in nearby code.

--
Added file: https://bugs.python.org/file44254/iss26040_v4.patch

___
Python tracker 

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



[issue26040] Improve coverage and rigour of test.test_math

2016-08-29 Thread Mark Dickinson

Mark Dickinson added the comment:

I've reviewed the test_math portion of the patch (which looks good, thank 
you!), and made a few revisions in iss26040_v3.patch.

1. I've rewritten the ulp() function to use struct. Same behaviour as before, 
but this way feels safer, since it doesn't rely on the exact form of the 
float.hex format.

2. I've reworked the ulp-based comparison to use the old to_ulps function, 
instead of basing it on ulp(). That's mostly just a personal preference: I 
prefer the symmetry of the abs(to_ulps(got) - to_ulps(expected)) form, and I 
think it behaves slightly better at or near powers of two. (If expected == 1.0 
and got == 1.0 - 2**-51, I want that to be seen as 4 ulps error rather than 2.)

3. I increased the default ulp tolerance to 5 ulps, and increased the ulps 
tolerance for some of the special cases. There are some badly behaved libm 
implementations out there, and I don't want to break more buildbots than 
necessary.

--
Added file: https://bugs.python.org/file44253/iss26040_v3.patch

___
Python tracker 

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



[issue27861] sqlite3 type confusion and multiple frees

2016-08-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c046cbb24f98 by Serhiy Storchaka in branch '3.5':
Issue #27861: Fixed a crash in sqlite3.Connection.cursor() when a factory
https://hg.python.org/cpython/rev/c046cbb24f98

New changeset 97dbba8a6d4a by Serhiy Storchaka in branch '2.7':
Issue #27861: Fixed a crash in sqlite3.Connection.cursor() when a factory
https://hg.python.org/cpython/rev/97dbba8a6d4a

New changeset afcec2d11e9e by Serhiy Storchaka in branch 'default':
Issue #27861: Fixed a crash in sqlite3.Connection.cursor() when a factory
https://hg.python.org/cpython/rev/afcec2d11e9e

--
nosy: +python-dev

___
Python tracker 

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



[issue27887] Installation failed

2016-08-29 Thread SilentGhost

Changes by SilentGhost :


--
resolution:  -> not a bug
stage:  -> resolved
type:  -> behavior

___
Python tracker 

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



[issue27887] Installation failed

2016-08-29 Thread Aleksandar Petrovic

Changes by Aleksandar Petrovic :


--
status: open -> closed

___
Python tracker 

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



[issue27877] Add recipe for "valueless" Enums to docs

2016-08-29 Thread John Hagen

John Hagen added the comment:

Emanuel, I like your rewording.  Uploaded a new patch incorporating it.

--
Added file: https://bugs.python.org/file44252/issue27877.johnthagen.02.patch

___
Python tracker 

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



[issue27877] Add recipe for "valueless" Enums to docs

2016-08-29 Thread John Hagen

Changes by John Hagen :


Removed file: https://bugs.python.org/file44249/issue27877.johnthagen.01.patch

___
Python tracker 

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



[issue27861] sqlite3 type confusion and multiple frees

2016-08-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue26040] Improve coverage and rigour of test.test_math

2016-08-29 Thread Mark Dickinson

Mark Dickinson added the comment:

iss26040.patch didn't apply cleanly to master (because of the recent math.tau 
addition). Here's an updated patch.

--
Added file: https://bugs.python.org/file44251/iss26040_v2.patch

___
Python tracker 

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



[issue27887] Installation failed

2016-08-29 Thread Aleksandar Petrovic

New submission from Aleksandar Petrovic:

Hi, got the following error message when I was trying to install Python. Im 
using 

"Installation failed.

The installer could not install the software.

The installer could not install the software because there was no software to 
install."

--
components: Macintosh
messages: 273852
nosy: Aleksandar Petrovic, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: Installation failed
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



[issue24045] Behavior of large returncodes (sys.exit(nn))

2016-08-29 Thread Eryk Sun

Eryk Sun added the comment:

Unix waitpid() packs the process exit status and terminating signal number into 
a single status value. As specified by POSIX [1], the WEXITSTATUS function 
returns only the lower 8 bits of the process exit status. In theory, waitid() 
and wait6() can return the full 32-bit status value in the siginfo_t si_status. 
Apparently NetBSD does this [2], but evidently Linux does not:

>>> p = subprocess.Popen(['python3', '-c','import os; os._exit(257)'])
>>> os.waitid(os.P_PID, p.pid, os.WEXITED).si_status
1

For Windows, programs sometimes return 16-bit WinAPI error codes or 32-bit 
HRESULT error codes. A critical error or unhandled exception may even result in 
returning a 32-bit NTSTATUS code (e.g. if you cancel the Windows error 
reporting dialog). 

Currently the Python 3 implementation of sys.exit and os._exit converts to a 
signed long, but the Windows exit code is an unsigned long. To use integer 
return codes in the range 0x8000-0x requires manually converting to 
the corresponding negative signed value.

Technically the two error types that require 32-bit values are signed (i.e. 
HRESULT and NTSTATUS), so this shouldn't be a problem. However, in practice 
sometimes a function -- and definitely subprocess.Popen -- returns an HRESULT 
error code as an unsigned value. 

It would be convenient, at least on Windows, if handle_system_exit in 
Python/pythonrun.c converted the value using PyLong_AsUnsignedLongMask instead 
of PyLong_AsLong. Similarly os._exit could use Argument Clinic's "unsigned int" 
format, which also calls PyLong_AsUnsignedLongMask.

The problem with using PyLong_AsLong on Windows (32-bit or 64-bit) is that it 
overflows with an error value of -1 for values greater than 0x7FFF. In this 
case, os._exit raises OverflowError. handle_system_exit, on the other hand, 
ignores the exception. It just uses the -1 error value as the exit code, i.e. 
0x. 

[1]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/wait.html
[2]: https://www.daemon-systems.org/man/wait.2.html

--
nosy: +eryksun

___
Python tracker 

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



[issue23831] tkinter canvas lacks of moveto method.

2016-08-29 Thread jf

jf added the comment:

i met the same problem, when i translate knighstour.tcl(upder tk demos dir) to 
tkinter.

--
nosy: +zaazbb

___
Python tracker 

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