[issue13501] Make libedit support more generic; port readline / libedit to FreeBSD

2016-03-21 Thread Martin Panter

Martin Panter added the comment:

Patch v3 is an update taking into account Ned’s comments, and my own now deeper 
understanding:

* Reworked the --with-readline handling. Suggested options are 
--with-readline=editline, and --without-readline. The current behaviour (use 
-lreadline if possible) should still work by default.
* Adjust the style of the configure.ac syntax to match surrounding code.
* Restore rl_completion_suppress_append check, independent of 
rl_completion_append_character.
* Remove completion_matches() #ifdef madness, originally spawned by Issue 
1703270, which makes no sense to me.
* Restored the runtime Editline checks protected by __APPLE__, but if 
WITH_EDITLINE is specified (e.g. on other platforms) the Editline support is 
always enabled and there are no runtime checks.

--
Added file: http://bugs.python.org/file42241/editline.v3.patch

___
Python tracker 

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



[issue17167] python man page contains $Date$ in page footer

2016-03-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ed85850499bd by Benjamin Peterson in branch '3.4':
remove useless $ keyword (closes #17167)
https://hg.python.org/cpython/rev/ed85850499bd

New changeset 86355b610d7c by Benjamin Peterson in branch '2.7':
remove useless $ keyword (closes #17167)
https://hg.python.org/cpython/rev/86355b610d7c

New changeset 4784717cb254 by Benjamin Peterson in branch '3.5':
merge 3.4 (#17167)
https://hg.python.org/cpython/rev/4784717cb254

New changeset c1edc2abbf97 by Benjamin Peterson in branch 'default':
merge 3.5 (#17167)
https://hg.python.org/cpython/rev/c1edc2abbf97

--
nosy: +python-dev
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

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



[issue26598] Embbedable zip does not import modules in (zip)subdirectory

2016-03-21 Thread Steve Dower

Steve Dower added the comment:

I used the python35.dll in the embeddable install, along with the python35.zip 
included in there. I linked against python.h and python35.lib from a full 
install, but put the resulting exe in the directory with the embeddable install 
so it uses that instead of the main one.

Probably I ought to write up a more detailed walkthrough on how to customise 
the embeddable install, but your feedback here is very valuable. Did you do 
things differently from what I put above? You're certainly not the only one to 
do whatever you did.

--

___
Python tracker 

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



[issue26598] Embbedable zip does not import modules in (zip)subdirectory

2016-03-21 Thread Zachary Ware

Zachary Ware added the comment:

I am also unable to reproduce.  I've attached the exact code I used, and built 
it with:

cl /I "C:\Program Files\Python35\include" embtest.c /link /libpath:"C:\Program 
Files\Python35\libs"

Output is the expected result of 'import ctypes;print(dir(ctypes))'.

Simon: If you run this code (including PyErr_Print();), what output do you get? 
 Are you sure that _ctypes.pyd is also available?  What happens if you import 
unittest instead of ctypes?  Or winsound?

Steve: I notice that the embeddable zip does not include 'include' or 'libs' 
dirs, was this deliberate?  I just noticed because it caused me to jump through 
an extra hoop to test this after I mistakenly downloaded the 32-bit embeddable 
zip on the first try, then had to go back for the 64-bit (or a 32-bit 
installer).  If it's deliberate (and preferably documented somewhere that I 
didn't check for), that's fine; I'm just curious.

--
Added file: http://bugs.python.org/file42240/embtest.c

___
Python tracker 

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



[issue26598] Embbedable zip does not import modules in (zip)subdirectory

2016-03-21 Thread Simon

Simon added the comment:

I have tried with the zip file in both the exe alongside the zip and not 
alongside it, (mine was not).

And I get the same error in both cases.

I am using Windows 10, VS2015.

I compile the Python35.dll directly and my config is default, I don't change 
anything really.

Do you build the Python35.dll or where do you get it from? Do you add something 
to your config?

--

___
Python tracker 

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



[issue15699] PEP 3121, 384 Refactoring applied to readline module

2016-03-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b5279feb22f1 by Martin Panter in branch '3.5':
Issue #15699: Reunite comment with variable
https://hg.python.org/cpython/rev/b5279feb22f1

New changeset 5c6a5b3bb6eb by Martin Panter in branch 'default':
Issue #15699: Merge readline fixup from 3.5
https://hg.python.org/cpython/rev/5c6a5b3bb6eb

--

___
Python tracker 

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



[issue26607] Rename a parameter in the function PyFile_FromFile

2016-03-21 Thread Mansour Moufid

New submission from Mansour Moufid:

Hi,

The last parameter of the function PyFile_FromFile is named 'close', but is a 
pointer to a function with the prototype of the 'fclose' function in libc. The 
mismatch causes confusion for some static analysis tools.

This patch renames the parameter to 'fclose'. Note that everywhere else 
PyFile_FromFile is called, that argument is always named fclose or pclose (or 
NULL), this was the one exception.

Thanks for your time.

--
files: 0001-PyFile_FromFile-Rename-close-parameter-to-fclose.patch
keywords: patch
messages: 262156
nosy: Mansour Moufid
priority: normal
severity: normal
status: open
title: Rename a parameter in the function PyFile_FromFile
type: enhancement
versions: Python 2.7
Added file: 
http://bugs.python.org/file42239/0001-PyFile_FromFile-Rename-close-parameter-to-fclose.patch

___
Python tracker 

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



[issue26605] Feature request: string method `to_file`

2016-03-21 Thread nickeubank

nickeubank added the comment:

Seems like existence of a method in the stdlib (or at least in the pathlib part 
of the stdlib) suggests issues with text encoding can be overcome. 

IMHO I would suggest most people have no idea about that method (I've been 
doing python for years and this has always been a personal frustration, and 
I've asked several others for better options and no one had one to offer),  and 
it seems like it would make much more sense as a string method. If someone has 
a string they want to save to disk, I can't imagine anyone looking in the Path 
library. 

I respect the desire to avoid bloat -- the context manager or open/close idiom 
has just felt unnecessarily complicated (dare I say unpythonic?) for a common 
task. 

Also, I think it's one that data scientists use a lot when they generate 
outputs to pull into LaTeX documents.

--

___
Python tracker 

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



[issue25251] Unknown MS Compiler version 1900

2016-03-21 Thread Jonathan Hanba

Jonathan Hanba added the comment:

I just ran across this bug in Python 3.5.1 while trying to build pycrypto using 
MinGW. I patched the cygwincompiler.py with the attached patch.diff file, and 
that got me part of the way there.

With the additions made by patch.diff, the MinGW linker then looked for 
vcruntime140.dll but it could not find it.

With the Python 3.5.1 installation, vcruntime140.dll is located in 
./Python35-32 directory, but it is not included in the library directories 
being passed into MinGW.

To fix this, I had to edit ./Lib/distutils/command/build_ext.py and add to line 
141:

self.library_dirs.append(os.path.join(sys.exec_prefix))

This adds the root of the Python35-32 directory to the library paths used by 
MinGW.

--
nosy: +hanbaj

___
Python tracker 

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



[issue24773] Implement PEP 495 (Local Time Disambiguation)

2016-03-21 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
hgrepos: +335

___
Python tracker 

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



[issue26588] _tracemalloc: add support for multiple address spaces (domains)

2016-03-21 Thread STINNER Victor

STINNER Victor added the comment:

About memory alignment, _Py_HASHTABLE_ENTRY_DATA_AS_VOID_P() macro uses pointer 
dereference. It may be replaced with _Py_HASHTABLE_ENTRY_READ_DATA() to use 
memcpy() and avoid memory alignment issue.

--

___
Python tracker 

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



[issue23749] asyncio missing wrap_socket (starttls)

2016-03-21 Thread Robert Siemer

Changes by Robert Siemer :


--
nosy: +siemer

___
Python tracker 

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



[issue26588] _tracemalloc: add support for multiple address spaces (domains)

2016-03-21 Thread STINNER Victor

STINNER Victor added the comment:

Hum, an assertion fails in set_reentrant(), helper function to set a TLS 
(Thread Local Storage), but I'm unable to reproduce the bug on my Fedora 23 
(AMD64).

http://buildbot.python.org/all/builders/AMD64%20Debian%20root%203.x/builds/3316/steps/test/logs/stdio

[187/400] test_tracemalloc
python: ./Modules/_tracemalloc.c:174: set_reentrant: Assertion 
`PyThread_get_key_value(tracemalloc_reentrant_key) == ((PyObject *) 
&_Py_TrueStruct)' failed.
Fatal Python error: Aborted

Current thread 0x7fecefd68700 (most recent call first):
  File 
"/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/test_tracemalloc.py", 
line 85 in setUp
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/unittest/case.py", 
line 596 in run
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/unittest/case.py", 
line 648 in __call__
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/unittest/suite.py", 
line 122 in run
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/unittest/suite.py", 
line 84 in __call__
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/unittest/suite.py", 
line 122 in run
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/unittest/suite.py", 
line 84 in __call__
  File 
"/root/buildarea/3.x.angelico-debian-amd64/build/Lib/unittest/runner.py", line 
176 in run
  File 
"/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/support/__init__.py", 
line 1802 in _run_suite
  File 
"/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/support/__init__.py", 
line 1836 in run_unittest
  File 
"/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/test_tracemalloc.py", 
line 824 in test_main
  File 
"/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/libregrtest/runtest.py",
 line 162 in runtest_inner
  File 
"/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/libregrtest/runtest.py",
 line 115 in runtest
  File 
"/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/libregrtest/main.py", 
line 295 in run_tests_sequential
  File 
"/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/libregrtest/main.py", 
line 356 in run_tests
  File 
"/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/libregrtest/main.py", 
line 392 in main
  File 
"/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/libregrtest/main.py", 
line 433 in main
  File 
"/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/libregrtest/main.py", 
line 455 in main_in_temp_cwd
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/__main__.py", 
line 3 in 
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/runpy.py", line 85 
in _run_code
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/runpy.py", line 184 
in _run_module_as_main
Makefile:1026: recipe for target 'buildbottest' failed
make: *** [buildbottest] Aborted

--

___
Python tracker 

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



[issue26606] logging.baseConfig is missing the encoding parameter

2016-03-21 Thread Jānis Šlapiņš

New submission from Jānis Šlapiņš:

Hi!
Log files are only saved using the system default encoding.
On Windows, this means that the current ANSI code page is used. This may lead 
to a disaster (exceptions may be thrown due to unmappable characters) if you 
want to log particular text strings in a foreign language, e.g. those read from 
a source file in the UTF-8 or UTF-16 encoding, and such strings contain 
characters not available in your ANSI code page.
I guess this issue does not affect Linux or Mac OSX as they already use the 
UTF-8 encoding for their system locales.

Actually, the logging module already has the built-in functionality for setting 
a particular encoding for output files. However, it was not added as a 
parameter of the baseConfig function (in __init__.py).

I added a patch file with suggested amendments.

I already tested writing logs with those changes applied and files are now 
saved in the specified encoding which differs from the Windows current ANSI 
page. For example:
logging.basicConfig(filename=log_path, filemode='w', encoding='utf-8', 
format='%(message)s', level=logging.INFO)

--
components: Library (Lib)
files: __init__.py.patch
keywords: patch
messages: 262150
nosy: janis.slapins
priority: normal
severity: normal
status: open
title: logging.baseConfig is missing the encoding parameter
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file42238/__init__.py.patch

___
Python tracker 

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



[issue26588] _tracemalloc: add support for multiple address spaces (domains)

2016-03-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 98a1c8cb882f by Victor Stinner in branch 'default':
Issue #26588: Fix compilation warning on Windows
https://hg.python.org/cpython/rev/98a1c8cb882f

--

___
Python tracker 

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



[issue26588] _tracemalloc: add support for multiple address spaces (domains)

2016-03-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset aca4e9af1ca6 by Victor Stinner in branch 'default':
hashtable.h now supports keys of any size
https://hg.python.org/cpython/rev/aca4e9af1ca6

--
nosy: +python-dev

___
Python tracker 

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



[issue26598] Embbedable zip does not import modules in (zip)subdirectory

2016-03-21 Thread Steve Dower

Steve Dower added the comment:

I can't reproduce this - I used almost exactly your code and it worked fine.

The one change I made was to use either L"python35.zip" alone (as my exe was 
alongside the zip) or a full path to the zip file. Both of these worked.

If the zip file is not found, you'll get an error. Is it possible that you are 
not actually pointing at the correct zip file?

--

___
Python tracker 

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



[issue17446] doctest test finder doesnt find line numbers of properties

2016-03-21 Thread Michael Cuthbert

Michael Cuthbert added the comment:

Here's a rather obscure bug that I was able to catch before we put this into 
action: doctests inside the __doc__ for namedtuples (and perhaps all 
namedtuples?) are instances of property, have .fget, but do not have 
.fget.__code__.  Thus one more check is needed:

if (lineno is None and 
isinstance(obj, property) and
obj.fget is not None and 
hasattr(obj.fget, '__code__')):
obj = obj.fget.__code__
lineno = getattr(obj, 'co_firstlineno', None)

--

___
Python tracker 

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



[issue26588] _tracemalloc: add support for multiple address spaces (domains)

2016-03-21 Thread STINNER Victor

STINNER Victor added the comment:

Hum, the patch is really too hard to review. So I extract to the "key_size" 
part: hashtable_key_size.patch.

I added new macros to get the key, wrapper to memcpy() with an assert to check 
the key size in debug mode.

--
Added file: http://bugs.python.org/file42237/hashtable_key_size.patch

___
Python tracker 

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



[issue26605] Feature request: string method `to_file`

2016-03-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Such function already exists in the stdlib! But with different order of 
arguments. See pathlib.Path.write_text().

Personally I'm very skeptical about usefulness of similar functions in the 
stdlib.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue26605] Feature request: string method `to_file`

2016-03-21 Thread STINNER Victor

STINNER Victor added the comment:

Oh. I wasn't aware of these pathlib methods.

https://docs.python.org/dev/library/pathlib.html#pathlib.Path.write_bytes

https://docs.python.org/dev/library/pathlib.html#pathlib.Path.write_text

--

___
Python tracker 

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



[issue26605] Feature request: string method `to_file`

2016-03-21 Thread STINNER Victor

STINNER Victor added the comment:

It's easy to implement such function in a module and upload such module to PyPI 
(ex: "to_file" module :-)).

It's not easy to guess user expectations on such function: text encoding, 
buffering, etc.

Adding a method to the builtin str type which writes into a file is a no-no.

--
nosy: +haypo

___
Python tracker 

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



[issue26605] Feature request: string method `to_file`

2016-03-21 Thread nickeubank

New submission from nickeubank:

As a social scientists trying to help other social scientists move from 
language like R, Stata, and Matlab into Python, one of the behaviors I've found 
unnecessarily difficult to explain is the "file.open()/file.close()" idiom (or, 
alternatively, context managers). In normal operating systems, and many high 
level languages, saving is a one-step operation. 

I understand there are situations where an open file handle is useful, but it 
seems a simple `to_file` method on strings (essentially wrapping a 
context-manager) would be really nice, as it would save users from learning 
this idiom. 

Any chance it's feasible? Sadly, I have no real C skills so can't implement 
myself. :(

--
components: IO
messages: 262141
nosy: nickeubank
priority: normal
severity: normal
status: open
title: Feature request: string method `to_file`
type: enhancement

___
Python tracker 

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



[issue26582] asyncio documentation links to wrong CancelledError

2016-03-21 Thread SilentGhost

SilentGhost added the comment:

In fact most of the :exc: reference are pointing explicitly to 
concurrent.futures.CancelledError (and those that don't probably should). It is 
interesting that you weren't able to make use of that exception, because in 
Lib/asyncio/futures.py#L23 it's clearly defined as an alias of the 
concurrent.futures.CancelledError.

I guess, ultimately, asyncio.CancelleError needs to be documented seeing how 
widely used it is.

--
nosy: +SilentGhost

___
Python tracker 

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



[issue26590] socket destructor: implement finalizer

2016-03-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a97d317dec85 by Victor Stinner in branch 'default':
Fix test_ssl.test_refcycle()
https://hg.python.org/cpython/rev/a97d317dec85

--

___
Python tracker 

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



[issue26604] Add optional source parameter to warnings.warn()

2016-03-21 Thread STINNER Victor

New submission from STINNER Victor:

Follow-up of the issue #26567 which added PyErr_ResourceWarning() (C API), 
attached patch adds a new source parameter to the warnings.warn() function 
(Python API).

source is the destroyed object which emits a ResourceWarning. The source is 
used to show the traceback where the object was created (allocated) when 
tracemalloc is used.

The patch also changes _pyio, asyncio and asyncore modules to set the source 
parameter.

Note: tempfile doesn't set source because it uses a class method:

@classmethod
def _cleanup(cls, name, warn_message):
_shutil.rmtree(name)
_warnings.warn(warn_message, ResourceWarning)

--
files: warnings_warn_source.patch
keywords: patch
messages: 262137
nosy: haypo
priority: normal
severity: normal
status: open
title: Add optional source parameter to warnings.warn()
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file42236/warnings_warn_source.patch

___
Python tracker 

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



[issue26604] Add optional source parameter to warnings.warn()

2016-03-21 Thread STINNER Victor

STINNER Victor added the comment:

For asyncio, it should help to fix the ResourceWarning warnings on AIX (which 
has a broken ssl module):

http://buildbot.python.org/all/builders/PPC64%20AIX%203.x/builds/4700/steps/test/logs/stdio

test_create_server_ssl_verify_failed 
(test.test_asyncio.test_events.PollEventLoopTests) ... FAIL
/home/shager/cpython-buildarea/3.x.edelsohn-aix-ppc64/build/Lib/unittest/case.py:628:
 ResourceWarning: unclosed 
  outcome.errors.clear()

--

___
Python tracker 

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



[issue26603] os.scandir: implement finalizer (for ResourceWarning)

2016-03-21 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +benhoyt

___
Python tracker 

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



[issue26603] os.scandir: implement finalizer (for ResourceWarning)

2016-03-21 Thread STINNER Victor

Changes by STINNER Victor :


--
keywords: +patch
Added file: http://bugs.python.org/file42235/scandir_finalizer.patch

___
Python tracker 

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



[issue26603] os.scandir: implement finalizer (for ResourceWarning)

2016-03-21 Thread STINNER Victor

New submission from STINNER Victor:

Attached patch implements a finalizer for os.scandir() iterator type. The patch 
also calls the new PyErr_ResourceWarning() function to be able to display in 
the warning where the iterator was created (allocated) when tracemalloc is 
enabled.

While it makes sense to pass an "open" socket to the logger of the 
ResourceWarning warning for sockets (issue #26590), maybe we can close the 
ScandirIterator *before* calling the logger?

Example:
---
import os
f = os.scandir('.')
f = None
---

Output:
---
$ ./python -X tracemalloc -Wd example.py 
example.py:3: ResourceWarning: unclosed scandir iterator 
  f = None
Object allocated at (most recent call first):
  File "example.py", lineno 2
f = os.scandir('.')
---

See also the issue #26590 "socket destructor: implement finalizer".

--
messages: 262136
nosy: haypo, pitrou, serhiy.storchaka
priority: normal
severity: normal
status: open
title: os.scandir: implement finalizer (for ResourceWarning)
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



[issue26590] socket destructor: implement finalizer

2016-03-21 Thread STINNER Victor

STINNER Victor added the comment:

Thanks for the review. I pushed my change.

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



[issue26588] _tracemalloc: add support for multiple address spaces (domains)

2016-03-21 Thread STINNER Victor

STINNER Victor added the comment:

Patch version 5:

* add hashtable_compare_pointer_t() which compares pointer_t fields (ptr and 
domain) rather using _Py_hashtable_compare_direct() which causes issues with 
padding
* hashtable_hash_pointer_t() now uses memcpy() to get the pointer_t value 
rather than a pointer dereference

Antoine:
> What about compilers that don't support "__attribute__((packed))"?

packed is a small and *optional* optimization on the memory footprint of 
_tracemalloc structure (reduce tracemalloc.get_tracemalloc_memory()).

Using packed can introduce memory alignment issue, but since tracemalloc uses 
memcpy(), it *should* be fine in practice. Again, since I don't have access to 
SPARC CPU, I don't know how to test.

> Instead you could use a compare func that compares struct fields...

Done.

--
Added file: http://bugs.python.org/file42234/tracemalloc-5.patch

___
Python tracker 

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



[issue26590] socket destructor: implement finalizer

2016-03-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 46329eec5515 by Victor Stinner in branch 'default':
Add socket finalizer
https://hg.python.org/cpython/rev/46329eec5515

--
nosy: +python-dev

___
Python tracker 

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



[issue26588] _tracemalloc: add support for multiple address spaces (domains)

2016-03-21 Thread Antoine Pitrou

Antoine Pitrou added the comment:

What about compilers that don't support "__attribute__((packed))"? Instead you 
could use a compare func that compares struct fields...

--

___
Python tracker 

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



[issue26588] _tracemalloc: add support for multiple address spaces (domains)

2016-03-21 Thread STINNER Victor

STINNER Victor added the comment:

> What about alignment issues on strict platforms? (SPARC?)

Which kind of alignment issue do you expect?

I added "__attribute__((packed))" to frame_t. I expected SIGBUS because of that 
(it's even documented in a comment ;-)), but I practice nobdy complained, not 
even our buildbots. Hum, it looks like we only have one SPARC buildbot and it's 
offline...

_Py_hashtable_get() uses memcpy() to copy the value, so this function should 
not have any alignment issue.

The new code uses pointer dereference, so alignment issues are more likely. How 
can I test it on Intel CPU?

Should I also use memcpy() to retrieve the key value?

--

___
Python tracker 

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



[issue26588] _tracemalloc: add support for multiple address spaces (domains)

2016-03-21 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> Instead of filling pointer_t padding with zeros, I changed the size of the 
> key (key_size) in the hashtable to exclude padding.

What about alignment issues on strict platforms? (SPARC?)

--

___
Python tracker 

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



[issue26590] socket destructor: implement finalizer

2016-03-21 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Yes, it looks good to me.

--

___
Python tracker 

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



[issue26590] socket destructor: implement finalizer

2016-03-21 Thread STINNER Victor

STINNER Victor added the comment:

> Oh, I see. Perhaps add a comment then?

Sure, done.

Does it look better now?

--
Added file: http://bugs.python.org/file42233/sock_finalize-3.patch

___
Python tracker 

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



[issue24459] Mention PYTHONFAULTHANDLER in the man page

2016-03-21 Thread Berker Peksag

Changes by Berker Peksag :


--
keywords: +easy
stage:  -> needs patch
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



[issue26588] _tracemalloc: add support for multiple address spaces (domains)

2016-03-21 Thread STINNER Victor

STINNER Victor added the comment:

Updated patch taking Antoine's comments in account.

Instead of filling pointer_t padding with zeros, I changed the size of the key 
(key_size) in the hashtable to exclude padding.

--
Added file: http://bugs.python.org/file42232/tracemalloc-4.patch

___
Python tracker 

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



[issue26590] socket destructor: implement finalizer

2016-03-21 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Oh, I see. Perhaps add a comment then?

--

___
Python tracker 

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



[issue26588] _tracemalloc: add support for multiple address spaces (domains)

2016-03-21 Thread STINNER Victor

STINNER Victor added the comment:

Crap. I pushed tracemalloc-3.patch by mistake. I just reverted my mistake.

At least, it helped to find first bugs using buildbots:

http://buildbot.python.org/all/builders/PPC64%20Fedora%203.x/builds/676/steps/test/logs/stdio

[230/400/3] test_tracemalloc
python: ./Modules/_tracemalloc.c:195: set_reentrant: Assertion 
`PyThread_get_key_value(tracemalloc_reentrant_key) == ((PyObject *) 
&_Py_TrueStruct)' failed.
Fatal Python error: Aborted

Current thread 0x3fffb0a95a10 (most recent call first):
  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-fedora-ppc64/build/Lib/test/test_tracemalloc.py",
 line 85 in setUp
  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-fedora-ppc64/build/Lib/unittest/case.py",
 line 596 in run

--

___
Python tracker 

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



[issue26590] socket destructor: implement finalizer

2016-03-21 Thread STINNER Victor

STINNER Victor added the comment:

On the review, Antoine wrote:
"You should put this line earlier, as outputting a warning can release the 
GIL..."

I disagree. It's a deliberate choice to keep the socket open while logging the 
ResourceWarning.

Example:
---
import socket
import warnings

def show(msg):
s = msg.source
#s.close()
if s.fileno() >= 0:
print("socket open")
else:
print("socket closed")
try:
name = s.getsockname()
except Exception as exc:
name = str(exc)
print("getsockname(): %r" % (name,))

warnings._showwarnmsg = show
s = socket.socket()
s = None
---

Output with  sock_finalize-2.patch:
---
socket open
getsockname(): ('0.0.0.0', 0)
---

If you uncomment the s.close() (or set sock_fd to -1 in the C code):
---
socket closed
getsockname(): '[Errno 9] Bad file descriptor'
---

IMHO it's ok to give access to socket methods in the warning logger.

--

___
Python tracker 

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



[issue17167] python man page contains $Date$ in page footer

2016-03-21 Thread Charalampos Stratakis

Charalampos Stratakis added the comment:

What do you think about just removing the keyword?

--
keywords: +patch
nosy: +cstratak
Added file: http://bugs.python.org/file42231/issue17167.patch

___
Python tracker 

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



[issue26590] socket destructor: implement finalizer

2016-03-21 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



[issue26591] datetime datetime.time to datetime.time comparison does nothing

2016-03-21 Thread SilentGhost

SilentGhost added the comment:

Jason, could you provide an actual paste of interactive interpreter session, so 
that any one could try to reproduce the issue.

--
nosy: +SilentGhost
stage:  -> test needed
type:  -> behavior

___
Python tracker 

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



[issue26602] argparse doc introduction is inappropriately targeted

2016-03-21 Thread Daniel Stone

New submission from Daniel Stone:

The argparse documentation starts off, after a couple of sentences, by spending 
several paragraphs (and a couple of sentences) explaining this gem:
import argparse

parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('integers', metavar='N', type=int, nargs='+',
   help='an integer for the accumulator')
parser.add_argument('--sum', dest='accumulate', action='store_const',
   const=sum, default=max,
   help='sum the integers (default: find the max)')

args = parser.parse_args()
print(args.accumulate(args.integers))


While it is undoubtedly impressive, that a sidebar had to be inserted 
suggesting people in fact refer to other documentation, suggests it may be 
inappropriate. As an introduction, it is not particularly approachable 
(especially if you don't catch the nuance of assigning functions to 
accumulate), and is probably not going to serve the immediate needs of a lot of 
the audience: the people who click on the first hit for 'python argparse'.

I would suggest relegating this example elsewhere in the documentation, with a 
much more straightforward/realistic example to lead the documentation.

--
assignee: docs@python
components: Documentation
messages: 262121
nosy: Daniel Stone, docs@python
priority: normal
severity: normal
status: open
title: argparse doc introduction is inappropriately targeted

___
Python tracker 

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



[issue26601] Use new madvise()'s MADV_FREE on the private heap

2016-03-21 Thread STINNER Victor

STINNER Victor added the comment:

Are you aware of unused memory in the heap memory?

The pymalloc memory allocator uses munmap() to release a wgole arena as
soon as the last memory block of an arena is freed.

--

___
Python tracker 

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



[issue26601] Use new madvise()'s MADV_FREE on the private heap

2016-03-21 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +neologix

___
Python tracker 

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



[issue26506] hex() documentation: mention "%x" % int

2016-03-21 Thread Ezio Melotti

Ezio Melotti added the comment:

> Note: Ezio, do you prefer format(value, 'x') for '{:x}'.format(value)?

While formatting a single value the former is better/shorter, but the latter is 
perhaps more common since you usually have something else in the string too.

The latter can also be used to do something like:
>>> '{num:x} {num:X} {num:#x} {num:#X}'.format(num=255)
'ff FF 0xff 0XFF'

--

___
Python tracker 

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



[issue26601] Use new madvise()'s MADV_FREE on the private heap

2016-03-21 Thread SilentGhost

Changes by SilentGhost :


--
nosy: +haypo

___
Python tracker 

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



[issue26590] socket destructor: implement finalizer

2016-03-21 Thread STINNER Victor

STINNER Victor added the comment:

> Now that there is a safe finalizer, I wonder if it should release the GIL, as 
> in sock_close().

Ah yes, good idea. I updated my patch.

I also changed the change to begin by setting the sock_fd attribute to -1, 
before closing the socket (since the GIL is now released, the order matters).

--
Added file: http://bugs.python.org/file42230/sock_finalize-2.patch

___
Python tracker 

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



[issue26601] Use new madvise()'s MADV_FREE on the private heap

2016-03-21 Thread Marcos Dione

New submission from Marcos Dione:

Linux kernel's new madvise() MADV_FREE[1] could be used in the memory allocator 
to signal unused parts of the private heap as such, allowing the kernel use 
those pages for resolving lowmem pressure situations. From a LWN article[2]:

[...] Rather than reclaiming the pages immediately, this operation marks them 
for "lazy freeing" at some future point. Should the kernel run low on memory, 
these pages will be among the first reclaimed for other uses; should the 
application try to use such a page after it has been reclaimed, the kernel will 
give it a new, zero-filled page. But if memory is not tight, pages marked with 
MADV_FREE will remain in place; a future access to those pages will clear the 
"lazy free" bit and use the memory that was there before the MADV_FREE call. 

[...] MADV_FREE appears to be aimed at user-space memory allocator 
implementations. When an application frees a set of pages, the allocator will 
use an MADV_FREE call to tell the kernel that the contents of those pages no 
longer matter. Should the application quickly allocate more memory in the same 
address range, it will use the same pages, thus avoiding much of the overhead 
of freeing the old pages and allocating and zeroing the new ones. In short, 
MADV_FREE is meant as a way to say "I don't care about the data in this address 
range, but I may reuse the address range itself in the near future." 

Also note that this feature already exists in BSD kernels.

--
[1] 
http://kernelnewbies.org/Linux_4.5#head-42578a3e087d5bcc2940954a38ce794fe2cd642c

[2] https://lwn.net/Articles/590991/

--
components: Interpreter Core
messages: 262117
nosy: StyXman
priority: normal
severity: normal
status: open
title: Use new madvise()'s MADV_FREE on the private heap
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



[issue17167] python man page contains $Date$ in page footer

2016-03-21 Thread Charalampos Stratakis

Changes by Charalampos Stratakis :


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



[issue26600] MagickMock __str__ sometimes returns MagickMock instead of str

2016-03-21 Thread SilentGhost

Changes by SilentGhost :


--
nosy: +michael.foord, pitrou
versions: +Python 3.6 -Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue26590] socket destructor: implement finalizer

2016-03-21 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Now that there is a safe finalizer, I wonder if it should release the GIL, as 
in sock_close().

--

___
Python tracker 

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



[issue26574] replace_interleave can be optimized for single character byte strings

2016-03-21 Thread STINNER Victor

STINNER Victor added the comment:

> Is it worth to optimize this pretty rare special case?

There was a TODO in the code, so I guess that the author wanted to write 
specialized code for 1-char replacement. Since the patch is short (adds 8 lines 
of C code), I consider that it's ok to optimize it.

--

___
Python tracker 

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



[issue26574] replace_interleave can be optimized for single character byte strings

2016-03-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Is it worth to optimize this pretty rare special case?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue26574] replace_interleave can be optimized for single character byte strings

2016-03-21 Thread STINNER Victor

STINNER Victor added the comment:

I pushed my latest patches, thanks for your contribution Josh.

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



[issue26574] replace_interleave can be optimized for single character byte strings

2016-03-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 62e3b7af0697 by Victor Stinner in branch 'default':
Optimize bytes.replace(b'', b'.')
https://hg.python.org/cpython/rev/62e3b7af0697

--
nosy: +python-dev

___
Python tracker 

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



[issue26574] replace_interleave can be optimized for single character byte strings

2016-03-21 Thread STINNER Victor

STINNER Victor added the comment:

I wrote a microbenchmark with my benchmark.py tool.

The patch always make bytes.replace(b'', char) and bytearray.replace(b'', char) 
faster even for strings of 10 bytes, the speedup on string of 1000 bytes or 
more is very interesting, even I never used this Python instruction :-)

-+-+---
type bytes   |orig |  patch
-+-+---
length=10|  250 ns (*) |  211 ns (-15%)
length=10**3 | 4.67 us (*) | 1.07 us (-77%)
length=10**5 |  441 us (*) | 78.2 us (-82%)
-+-+---
Total|  446 us (*) | 79.5 us (-82%)
-+-+---

---+-+---
type bytearray |orig |  patch
---+-+---
length=10  |  266 ns (*) |  224 ns (-16%)
length=10**3   | 4.67 us (*) | 1.08 us (-77%)
length=10**5   |  441 us (*) | 78.3 us (-82%)
---+-+---
Total  |  446 us (*) | 79.6 us (-82%)
---+-+---

---++---
Summary|   orig |  patch
---++---
type bytes | 446 us (*) | 79.5 us (-82%)
type bytearray | 446 us (*) | 79.6 us (-82%)
---++---
Total  | 892 us (*) |  159 us (-82%)
---++---

--
Added file: http://bugs.python.org/file42229/bench.py

___
Python tracker 

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



[issue26506] hex() documentation: mention "%x" % int

2016-03-21 Thread STINNER Victor

STINNER Victor added the comment:

Ezio Melotti added the comment:
> I can think of 3 possible solutions:
>
> 1) keep the examples but condense them so that they don't take so much space:
 n = 255
 f'{n:#x}', format(n, '#x'), '%#x' % n
> ('0xff', '0xff', '0xff')
 f'{n:x}', format(n, 'x'), '%x' % n
> ('ff', 'ff', 'ff')
 f'{n:X}', format(n, 'X'), '%X' % n
> ('FF', 'FF', 'FF')

Hum. It's not easy to read these complex formatting strings when they are 
written like that.

> or
>
 '%#x' % 255, '%x' % 255, '%X' % 255
> ('0xff', 'ff', 'FF')
 format(255, '#x'), format(255, 'x'), format(255, 'X')
> ('0xff', 'ff', 'FF')
 f'{255:#x}', f'{255:x}', f'{255:X}'
> ('0xff', 'ff', 'FF')

I really prefer when the same kind of the formating strings are written on the 
same line. I really like this example. Short, obvious, easy to read.

I have a prefererence for an example using a variable name rather than a number 
literal. It's more common to manipulate variables than number literals.

If you use a variable, please use a variable name longer than "n" to get more 
readable example. Otherwise, it's not obvious what is in the variable name in 
"{n:x}": is "n" the variable? is "x" the variable?


In short, I suggest this example:

>>> value = 255
>>> '%#x' % value, '%x' % value, '%X' % value
('0xff', 'ff', 'FF')
>>> format(value, '#x'), format(value, 'x'), format(value, 'X')
('0xff', 'ff', 'FF')
>>> f'{value:#x}', f'{value:x}', f'{value:X}'
('0xff', 'ff', 'FF')


Note: Ezio, do you prefer format(value, 'x) for '{:x}'.format(value)?


> 2) add a direct link to 
> https://docs.python.org/3/library/string.html#format-examples where there are 
> already some examples (more can be added if needed);

IMHO it's ok to add formatting examples to bin/hex/oct. Using your compact 
example, it's not going to make the doc too long.

--

___
Python tracker 

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



[issue26506] hex() documentation: mention "%x" % int

2016-03-21 Thread Ezio Melotti

Ezio Melotti added the comment:

> The documentation for hex() doesn't look the bests place for examples
> of using string formatting. I think it is enough to add short
> references to corresponding formatting codes.

I think those examples take too much space compared to the actual docs of the 
functions.

I can think of 3 possible solutions:

1) keep the examples but condense them so that they don't take so much space:
>>> n = 255
>>> f'{n:#x}', format(n, '#x'), '%#x' % n
('0xff', '0xff', '0xff')
>>> f'{n:x}', format(n, 'x'), '%x' % n
('ff', 'ff', 'ff')
>>> f'{n:X}', format(n, 'X'), '%X' % n
('FF', 'FF', 'FF')

or

>>> '%#x' % 255, '%x' % 255, '%X' % 255
('0xff', 'ff', 'FF')
>>> format(255, '#x'), format(255, 'x'), format(255, 'X')
('0xff', 'ff', 'FF')
>>> f'{255:#x}', f'{255:x}', f'{255:X}'
('0xff', 'ff', 'FF')

(the latter should only go in 3.6 though)

2) add a direct link to 
https://docs.python.org/3/library/string.html#format-examples where there are 
already some examples (more can be added if needed);

3) add a single footnote for all 3 functions that includes examples using 
old/new string formatting and f-strings, mentions the fact that # can be used 
to omit the prefix and the fact that b/o/x and B/O/X can be used for lowercase 
and uppercase output.

FWIW I don't think that performances matter too much in this case, but I also 
dislike hex(value)[2:] and agree it should not be mentioned.

--
nosy: +ezio.melotti

___
Python tracker 

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



[issue26506] hex() documentation: mention "%x" % int

2016-03-21 Thread STINNER Victor

STINNER Victor added the comment:

Serhiy Storchaka:
> The documentation for hex() doesn't look the bests place for examples of 
> using string formatting. I think it is enough to add short references to 
> corresponding formatting codes.

I like Manvi B's patch with many examples. It's hard to read formatting 
strings, it's hard to compute the result, so full examples are just more 
obvious.

I don't think that it hurts to add many formatting examples. I expect that most 
users will combine the result of bin/hex/oct with another string, so suggesting 
using formatting functions will probably help them to simplify the code.

For example,
   print("x=", hex(x), "y=", hex(y))
can be written:
   print("x=%#x y=%#x" % (x, y))
or
   print("x={:#x} y={:#x}".format(x, y))
or
   print(f"x={x:#x} y={y:#x}")

The first expression using hex() adds spaces after "=", but well, it's just to 
give a simple example. IMHO formatting strings are more readable.

--

___
Python tracker 

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



[issue26506] hex() documentation: mention "%x" % int

2016-03-21 Thread Manvi B

Manvi B added the comment:

Modified the patch with '%x' % value.

--
Added file: http://bugs.python.org/file42228/issue26506.diff

___
Python tracker 

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



[issue11874] argparse assertion failure with brackets in metavars

2016-03-21 Thread Matt Pr

Matt Pr added the comment:

Same AssertionError is also caused by having certain "choices".

Python 2.7.10

global_options.add_argument('--field-sep', choices=[',',';','|','\t'], 
required=True, help='Field separator that separates columns in a row.')

Removing required=True or removing the tab (\t) from the options both work 
around this usage formatter issue for me.

I know this is an old issue but figured I would add another repro case to help 
whoever might work on this.

--
nosy: +mattpr

___
Python tracker 

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



[issue26506] hex() documentation: mention "%x" % int

2016-03-21 Thread Manvi B

Manvi B added the comment:

Removed hex()[:2] from the patch.

--
Added file: http://bugs.python.org/file42227/issue26506.diff

___
Python tracker 

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



[issue26600] MagickMock __str__ sometimes returns MagickMock instead of str

2016-03-21 Thread Uosiu

New submission from Stanisław Skonieczny (Uosiu):

This bug results in raising TypeError: __str__ returned non-string (type 
MagicMock)
Following program can reproduce it:

```
from threading import Thread
from mock.mock import MagicMock


def main():
mocks = [MagicMock() for _ in range(1000)]

def in_thread():
for m in mocks:
str(m)

threads = [Thread(target=in_thread) for _ in range(10)]
for thread in threads:
thread.start()
for thread in threads:
thread.join()


if __name__ == '__main__':
main()
```

For me it rasies few times:

```
Exception in thread Thread-6:
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/threading.py", line 923, in _bootstrap_inner
self.run()
  File "/usr/local/lib/python3.5/threading.py", line 871, in run
self._target(*self._args, **self._kwargs)
  File "../misc/magic_mock_str_bug.py", line 11, in in_thread
str(m)
TypeError: __str__ returned non-string (type MagicMock)
```

--
components: Library (Lib)
messages: 262104
nosy: Stanisław Skonieczny (Uosiu)
priority: normal
severity: normal
status: open
title: MagickMock __str__ sometimes returns MagickMock instead of str
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5

___
Python tracker 

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



[issue26599] segfault at 24 error 6 in python

2016-03-21 Thread SilentGhost

SilentGhost added the comment:

This very much looks like a sentry problem. I'd suggest reporting it on their 
bug tracker.

--
nosy: +SilentGhost
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue26599] segfault at 24 error 6 in python

2016-03-21 Thread Hưng Nguyễn Việt

New submission from Hưng Nguyễn Việt:

I'm running Python 2.7.6-8ubuntu0.2 amd64 on Ubuntu 14.04 with kernel 
3.13.0-52-generic and got this segfault errors every time I ran 
/usr/local/sentry/bin/sentry cleanup from sentry 7.4.1 
(https://github.com/getsentry/sentry/tree/7.4.1)

[22209647.263243] /usr/local/sent[11702]: segfault at 24 ip 005377c7 sp 
7ffc05c8f930 error 6 in python[40+2bc000]
[22295939.402502] /usr/local/sent[390]: segfault at 24 ip 005377c7 sp 
7ffdd3e66ca0 error 6 in python[40+2bc000]
[22296013.421469] /usr/local/sent[891]: segfault at 24 ip 00558077 sp 
7fffc16e5e50 error 6 in python[40+2bc000]
[22296046.492933] /usr/local/sent[1059]: segfault at 24 ip 005377c7 sp 
7ffc84414130 error 6 in python[40+2bc000]
[22296379.961611] /usr/local/sent[2512]: segfault at 24 ip 005377c7 sp 
7ffca4920410 error 6 in python[40+2bc000]
[22297323.455115] /usr/local/sent[7184]: segfault at 24 ip 005377c7 sp 
7fff61f88d50 error 6 in python[40+2bc000]
[22297362.031536] /usr/local/sent[7377]: segfault at 24 ip 005377c7 sp 
7ffc99085470 error 6 in python[40+2bc000]
[22297587.731566] /usr/local/sent[8287]: segfault at 24 ip 004e265f sp 
7ffd70af3eb0 error 6 in python[40+2bc000]
[22298739.800342] /usr/local/sent[27513]: segfault at 24 ip 005377c7 sp 
7ffcaf9f2050 error 6 in python[40+2bc000]

This happened every time I ran /usr/local/sentry/bin/sentry cleanup from sentry 
7.4.1

--
components: Interpreter Core
messages: 262102
nosy: hvnsweeting
priority: normal
severity: normal
status: open
title: segfault at 24 error 6 in python
type: crash
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



[issue26598] Embbedable zip does not import modules in (zip)subdirectory

2016-03-21 Thread Simon

Changes by Simon :


--
components: +Interpreter Core, Windows

___
Python tracker 

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