[issue20256] Argument Clinic: compare signed and unsigned ints

2014-01-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

(unsigned int)-1 etc.

--

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



[issue20262] Convert some debugging prints in zipfile to warnings

2014-01-16 Thread Larry Hastings

Larry Hastings added the comment:

I will bow to the wisdom of my predecessor and accept this patch for beta 3.

--

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



[issue20133] Derby: Convert the audioop module to use Argument Clinic

2014-01-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I mean I want to add support for float32 and float64 in audioop functions. In 
that case return value of getsample(), max(), ets will be no longer integer for 
float format.

--

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



[issue20226] Argument Clinic: support for simple expressions?

2014-01-16 Thread Larry Hastings

Larry Hastings added the comment:

Okay, I have a fix for the help(os.chmod) problem, that'll be in the next 
refreshed patch.

--

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



[issue20226] Argument Clinic: support for simple expressions?

2014-01-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Why not allow arbitrary string as py_default?

--

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



[issue20226] Argument Clinic: support for simple expressions?

2014-01-16 Thread Larry Hastings

Larry Hastings added the comment:

Isn't that what it does?

I may actually remove py_default.  Nobody uses it, and I don't think you need 
it--you just specify what you want as the real default value.

--

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



[issue20277] default __debug__ value and asserts

2014-01-16 Thread xwild

New submission from xwild:

Why the python sets the __debug__ builtin = True by default?
It causes that people never use the assert construction 
by their programms in a regular way.

it's too hard to explain everyone that -O is required by a script.
It's very usefull instruction and actually it's blocked by default.

--
components: Interpreter Core, Tests
messages: 208256
nosy: xwild
priority: normal
severity: normal
status: open
title: default __debug__ value and asserts
type: behavior
versions: 3rd party, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 
3.4, Python 3.5

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



[issue20276] ctypes._dlopen should not force RTLD_NOW

2014-01-16 Thread STINNER Victor

STINNER Victor added the comment:

FYI, dlopen() flags are configurable:
-  sys.setdlopenflags(n): default=RTLD_NOW (if available, or RTLD_LAZY 
otherwise)
- mode parameter of dl.dlopen(): default=RTLD_LAZY
- mode parameter of ctypes.CDLL: default=RTLD_LOCAL (but RTLD_GLOBAL on Mac OS 
X = 10.3); but RTLD_NOW is always added

See also:
How to disable RTLD_NOW for Python 2.7.x dlopen() in Mac OS X Mavericks?
https://groups.google.com/forum/#!msg/comp.lang.python/DKmNGwyLl3w/1tuxcnwBAw8J

how to handle library interdependencies
http://osdir.com/ml/python.ctypes/2006-10/msg00022.html

Need RTLD_GLOBAL for linux?
http://code.google.com/p/ctypesgen/issues/detail?id=3

--

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



[issue20182] Derby #13: Convert 50 sites to Argument Clinic across 5 files

2014-01-16 Thread Georg Brandl

Georg Brandl added the comment:

New patch addressing comments.

--

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



[issue20182] Derby #13: Convert 50 sites to Argument Clinic across 5 files

2014-01-16 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


Added file: http://bugs.python.org/file33491/modules_issue20182_v2.patch

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



[issue20226] Argument Clinic: support for simple expressions?

2014-01-16 Thread Larry Hastings

Larry Hastings added the comment:

Second rollup patch.  More small fixes, many suggested by other folks.

--
Added file: 
http://bugs.python.org/file33492/larry.clinic.rollup.patch.two.diff.2.txt

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



[issue20226] Argument Clinic: support for simple expressions?

2014-01-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It would be better if you commit a patch which changes PyTuple_Size to 
PyTuple_GET_SIZE in separate commit.

--

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



[issue20277] default __debug__ value and asserts

2014-01-16 Thread xwild

Changes by xwild xwild.w...@gmail.com:


--
versions:  -3rd party

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



[issue20278] Wrong URL to the pysqlite web page

2014-01-16 Thread Richard Philips

New submission from Richard Philips:

The reference to the pysqlite web page on:

http://docs.python.org/3.4/library/sqlite3.html

should be:

https://github.com/ghaering/pysqlite

--
assignee: docs@python
components: Documentation
messages: 208261
nosy: Richard.Philips, docs@python
priority: normal
severity: normal
status: open
title: Wrong URL to the pysqlite web page
versions: Python 3.4

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



[issue20227] Argument Clinic: rename arguments in generated C?

2014-01-16 Thread Ryan Smith-Roberts

Ryan Smith-Roberts added the comment:

The use case is primarily to minimize code churn for the derby, but since 
you're the one (heroically) doing the code review it's really your call. I 
whipped up a quick patch for this feature, and even if you remove c_name from 
__init__ I think it's still a small cleanup.

--
keywords: +patch
Added file: 
http://bugs.python.org/file33493/argument_clinic_rename_c_variable.patch

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



[issue20227] Argument Clinic: rename arguments in generated C?

2014-01-16 Thread Ryan Smith-Roberts

Changes by Ryan Smith-Roberts r...@lab.net:


Added file: 
http://bugs.python.org/file33494/argument_clinic_ensure_legal_cleanup.patch

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



[issue20277] default __debug__ value and asserts

2014-01-16 Thread xwild

Changes by xwild xwild.w...@gmail.com:


--
nosy: +serhiy.storchaka

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



[issue20277] default __debug__ value and asserts

2014-01-16 Thread xwild

Changes by xwild xwild.w...@gmail.com:


--
nosy: +ezio.melotti, michael.foord, pitrou

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



[issue20275] asyncio: remove debug code from BaseEventLoop

2014-01-16 Thread STINNER Victor

STINNER Victor added the comment:

 I like logger_is_enabled_for.patch.

I prefer debug_flag.patch because it is faster than logger_is_enabled_for.patch 
(see msg208214). I would like to write the most efficient code for 
BaseEventLoop._run_once() because this function is the real core of asyncio and 
it is called very frequently.

Test attached event_loop_run_once.py script. On such dummy example, _run_once() 
is called 4 times.

Note: Thanks to the nice design of yield from, wrapper() doesn't add an extra 
call to _run_once()!


Please think also to Trollius (port of asyncio on Python 2) which uses yield 
instead of yield-from. The same example calls _run_once() 10 times! The wrapper 
itself uses 2 calls. I don't know yet if Trollius can be modified to call 
_run_once() less frequently. It may be hard to keep the scheduling fair between 
concurrent running tasks.

--
Added file: http://bugs.python.org/file33495/event_loop_run_once.py

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



[issue20174] Derby #5: Convert 50 sites to Argument Clinic across 3 files

2014-01-16 Thread Ryan Smith-Roberts

Ryan Smith-Roberts added the comment:

Here's sendmsg with only nested bracket optional args. If Rietveld doesn't like 
this patch I may cry.

--
Added file: 
http://bugs.python.org/file33496/argument_clinic_socketmodule_v4.patch

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



[issue20232] Argument Clinic NULL default falsely implies None acceptability

2014-01-16 Thread Ryan Smith-Roberts

Ryan Smith-Roberts added the comment:

After all our discussions I'm closing this with resolution don't do that then.

--
resolution:  - wont fix
status: open - closed

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



[issue20226] Argument Clinic: support for simple expressions?

2014-01-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Excellent! I'm rewriting the zlib module and the code becomes much cleaner with 
this patch.

There is one problem left -- Py_buffer doesn't support default value at all.

Such code

/*[clinic input]
zlib.compressobj
zdict: Py_buffer = unspecified
[clinic start generated code]*/

produces error:

When you specify a named constant ('unspecified') as your default value,
you MUST specify a valid c_default.

But this code

/*[clinic input]
zlib.compressobj
zdict: Py_buffer(c_default={NULL, NULL}) = unspecified
[clinic start generated code]*/

produces error too:

The only legal default value for Py_buffer is None.

And specifying c_default=None returns first error.

--

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



[issue20277] default __debug__ value and asserts

2014-01-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Specify the -O option in she-bang:

#!/usr/bin/env python3 -O

--

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



[issue20277] default __debug__ value and asserts

2014-01-16 Thread xwild

xwild added the comment:

Yes it's acceptable, but why the debug mode is enabled by default?
It's a not expected behavior.

--

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



[issue20185] Derby #17: Convert 49 sites to Argument Clinic across 13 files

2014-01-16 Thread Vajrasky Kok

Vajrasky Kok added the comment:

With little modification:

class PID_converter(int_converter):
  type = 'pid_t'
  format_unit = ' _Py_PARSE_PID '

It works. Thanks! But I got unnecessary empty string:

if (!PyArg_ParseTuple(args,  _Py_PARSE_PID i:prlimit, pid, resource))

It should be:

if (!PyArg_ParseTuple(args, _Py_PARSE_PID i:prlimit, pid, resource))

Anyway, that is trivial problem. Now I hit a hard one. How do you convert this 
signature?

-if (!PyArg_ParseTuple(args, _Py_PARSE_PID i|(OO):prlimit,
-  pid, resource, curobj, maxobj))

I create custom converters:

+class TupleOpen_converter(object_converter):
+  format_unit = '(O'
+class TupleClose_converter(object_converter):
+  format_unit = 'O)'

and

+/*[clinic input]
+resource.prlimit
+
+pid: PID
+resource: int
+[
+curobj: TupleOpen
+maxobj: TupleClose
+]
+/
+[clinic start generated code]*/

But I got invalid argument size in the generated code.

+case 2:
+if (!PyArg_ParseTuple(args,  _Py_PARSE_PID i:prlimit, pid, 
resource))
+return NULL;
+break;
+case 4:    should be case 3:
+if (!PyArg_ParseTuple(args,  _Py_PARSE_PID i(OO):prlimit, 
pid, resource, curobj, maxobj))
+return NULL;
+group_right_1 = 1;
+break;
+default:
+PyErr_SetString(PyExc_TypeError, resource.prlimit requires 2 to 4 
arguments); === should be 2 to 3 arguments
+return NULL;

Any idea, Larry?

--

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



[issue20277] default __debug__ value and asserts

2014-01-16 Thread Michael Foord

Michael Foord added the comment:

Having __debug__ True by default is unintuitive and not particularly useful. 
However it is relatively well known, so although it is rarely used that 
probably only means hundreds of thousands of piece of code. So it isn't going 
to change I'm afraid.

--
resolution:  - wont fix
stage:  - committed/rejected
status: open - closed

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



[issue20185] Derby #17: Convert 49 sites to Argument Clinic across 13 files

2014-01-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is known bug in prlimit (issue20191).

--
nosy: +serhiy.storchaka

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



[issue20191] resource.prlimit(int, int, str) crashs

2014-01-16 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
priority: normal - critical

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



[issue20191] resource.prlimit(int, int, str) crashs

2014-01-16 Thread STINNER Victor

STINNER Victor added the comment:

There is another option: modify the function to use argument clinic and 
implement something in argument clinic to hold a reference on borrowed 
references O and hold a reference on (...) sequence.

Holding a reference on borrowed references O would make Python more safer 
against a whole class of bugs.

--
nosy: +larry

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



[issue20279] bytearray.fromhex does not work with some hexes generated by hex

2014-01-16 Thread Anatoly Belikov

New submission from Anatoly Belikov:

bytearray.fromhex(hex(434)[2:]) 

throws ValueError: non-hexadecimal number found in fromhex() arg at position 2

Strangely it works with leading zero:

bytearray.fromhex('0' + hex(438)[2:])

--
components: Library (Lib)
messages: 208273
nosy: Anatoly Belikov
priority: normal
severity: normal
status: open
title: bytearray.fromhex does not work with some hexes generated by hex
type: behavior
versions: Python 3.3

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



[issue20279] bytearray.fromhex does not work with some hexes generated by hex

2014-01-16 Thread Anatoly Belikov

Anatoly Belikov added the comment:

ok i gave it half byte

--
resolution:  - invalid
status: open - closed

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



[issue20262] Convert some debugging prints in zipfile to warnings

2014-01-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Well, then I should only ask Benjamin.

--
nosy: +benjamin.peterson
versions: +Python 3.3, Python 3.4

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



[issue19936] Executable permissions of Python source files

2014-01-16 Thread Matthias Klose

Matthias Klose added the comment:

I like this, and I'm doing this in the Debian/Ubuntu packaging anyway.  But I 
would like to see some check script which maybe can be run before a release, 
that points out regressions or wrong permissions for newly introduced files.

--
nosy: +doko

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



[issue20280] add predicate to the glossary

2014-01-16 Thread Florent Xicluna

New submission from Florent Xicluna:

This term is used in various places in the documentation.
http://docs.python.org/dev/search.html?q=predicate

Probably it deserves an entry in the glossary, even if it is not specific to 
Python:
http://en.wikipedia.org/wiki/Predicate_%28mathematical_logic%29

--
assignee: docs@python
components: Documentation
messages: 208277
nosy: docs@python, flox
priority: low
severity: normal
status: open
title: add predicate to the glossary
type: enhancement
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5

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



[issue19936] Executable permissions of Python source files

2014-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9062a8695c89 by Stefan Krah in branch '3.3':
Issue #19936: Disable shebang lines in order to prevent using a random
http://hg.python.org/cpython/rev/9062a8695c89

--
nosy: +python-dev

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



[issue20278] Wrong URL to the pysqlite web page

2014-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b73b35d1c58d by Benjamin Peterson in branch '3.3':
update pysqlite website (closes #20278)
http://hg.python.org/cpython/rev/b73b35d1c58d

New changeset 40289a03569f by Benjamin Peterson in branch '2.7':
update pysqlite website (closes #20278)
http://hg.python.org/cpython/rev/40289a03569f

New changeset e6ecbdb794a9 by Benjamin Peterson in branch 'default':
merge 3.3 (#20278)
http://hg.python.org/cpython/rev/e6ecbdb794a9

--
nosy: +python-dev
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue20278] Wrong URL to the pysqlite web page

2014-01-16 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Done. Of course, the Python version of sqlite hasn't been updated in ages (and 
has probably diverged!), so it might not be that relevant anymore.

--
nosy: +benjamin.peterson

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



[issue20272] chain.from_iterable in the overview table not linking to the function

2014-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset aa88c8265e94 by Benjamin Peterson in branch '3.3':
linkify chain.from_iterable (closes #20272)
http://hg.python.org/cpython/rev/aa88c8265e94

New changeset 58cac9967cf0 by Benjamin Peterson in branch 'default':
merge 3.3 (#20272)
http://hg.python.org/cpython/rev/58cac9967cf0

--
nosy: +python-dev
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

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



[issue6128] Consequences of using Py_TPFLAGS_HAVE_GC are incompletely explained

2014-01-16 Thread Christian Aichinger

Christian Aichinger added the comment:

I concur that this aspect of writing Python types in C/C++ needs better
documentation. For a new extension writer (like me), it is not obvious when
PyObject_GC_Track/PyObject_GC_UnTrack must be called or not. Similarly, it is
not clear from the current documentation how to ensure that memory is allocated
with PyObject_GC_New.

The gcsupport documentation suffers from being written from the perspective
of the GC, instead of the perspective of extension writers. Thus, I've attached
a patch that tries to shed some light on how to correctly write types
implementing cyclic GC support.

I'd appreciate comments/editing suggestions/advice and would welcome the patch
to go into Python in some form. I myself consider the change to be trivial, but
if necessary I can sign the contributor agreement.

--
PS: Informal explanation about what's really going on:

The Python GC code deals with memory allocation, not with initialization in any
way. For most extension types, allocation is handled by tp_alloc which is
called typically called from tp_new (either the default tp_new or your own
tp_new handler).

The default tp_alloc (PyType_GenericAlloc()) looks at tp_flags, and if
Py_TPFLAGS_HAVE_GC is specified, it uses the appropriate GC malloc function and
calls _PyObject_GC_TRACK when finished). Thus, if you allocate your memory via
tp_alloc, and don't override the tp_alloc handler, you've just fulfilled the
GC's constructor requirements.

Similarly, the GC doesn't care about object destruction. It cares about freeing
memory, that is tp_free, NOT tp_dealloc! Again, if you don't intentionally
provide a custom tp_free handler, the default one will take care to obey the GC
rules.

Thus, most extension writers can get away with 4 simple rules:
* Set Py_TPFLAGS_HAVE_GC in tp_flags.
* Do not specify tp_alloc or tp_free.
* Make sure your object actually allocates it's memory via tp_alloc.
  Three possibilities to achieve this:
+ Do not add a tp_new handler, or
+ Call tp_alloc from your tp_new handler, or
+ Call a base class's tp_new from your own tp_new handler
* Implement tp_traverse and tp_clear. They are usually straight-forward.

And if you really do want a custom allocator, you're screwed anyway, as the
last part of my patch hints at. Custom memory management is just not compatible 
with the GC at this point.

--
keywords: +patch
nosy: +Greek0
versions: +Python 3.5
Added file: http://bugs.python.org/file33497/gcsupport-doc.diff

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



[issue19936] Executable permissions of Python source files

2014-01-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a script. It lists text files with executable bits and without shebangs 
and files with .py, .pyw, or .sh suffix which have shebang but have not with 
executable bits.

As far as it searches not only Python files, now it found such files:

- ./python-gdb.py
- ./Doc/includes/email-unpack.py
- ./Doc/includes/email-alternative.py
- ./Doc/includes/email-dir.py
- ./Misc/python-config.sh
x ./Mac/PythonLauncher/MyDocument.m
x ./Mac/PythonLauncher/MyDocument.h
x ./Mac/PythonLauncher/FileSettings.m
x ./Mac/PythonLauncher/main.m
x ./Mac/PythonLauncher/FileSettings.h
- ./Tools/test2to3/maintest.py
x ./Tools/scripts/pydocgui.pyw
x ./Lib/idlelib/idle.bat
- ./Modules/_ctypes/libffi/build-ios.sh
x ./Modules/_ctypes/libffi/ltmain.sh
- ./Modules/_ctypes/libffi/msvcc.sh
- ./Modules/_ctypes/libffi/src/arm/gentramp.sh
x ./Modules/_decimal/tests/deccheck.py
x ./Modules/_decimal/tests/runall.bat
x ./Modules/_decimal/tests/bench.py
x ./PC/msvcrtmodule.c

--
Added file: http://bugs.python.org/file33498/findnoshebang.py

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



[issue20227] Argument Clinic: rename arguments in generated C?

2014-01-16 Thread Zachary Ware

Zachary Ware added the comment:

The nested scope trick makes me happy.  There are still a lot of cases in the 
conversions I've worked on where a variable had to be renamed due to having 
documented a different name for the parameter, but in the vast majority of 
those cases the new name makes more sense anyway.

--

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



[issue19936] Executable permissions of Python source files

2014-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 92fd0df03823 by Serhiy Storchaka in branch '3.3':
Issue #19936: Added executable bits or shebang lines to Python scripts which
http://hg.python.org/cpython/rev/92fd0df03823

New changeset 83009d70bc9c by Serhiy Storchaka in branch 'default':
Issue #19936: Added executable bits or shebang lines to Python scripts which
http://hg.python.org/cpython/rev/83009d70bc9c

--

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



[issue19936] Executable permissions of Python source files

2014-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 085a0ea2015f by Serhiy Storchaka in branch '3.3':
Issue #19936: Remove executable bits from C source files and several forgotten
http://hg.python.org/cpython/rev/085a0ea2015f

New changeset 6baeee39195b by Serhiy Storchaka in branch 'default':
Issue #19936: Remove executable bits from C source files and several forgotten
http://hg.python.org/cpython/rev/6baeee39195b

--

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



[issue20226] Argument Clinic: support for simple expressions?

2014-01-16 Thread Larry Hastings

Larry Hastings added the comment:

Py_buffer is currently inflexible.  The only default value it accepts is None.  
If you want it to be required, give it no default value.  If you want it to be 
optional, give it a default value of None.

Do you have a use case for any other default value?

--

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



[issue19936] Executable permissions of Python source files

2014-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 334116bb2939 by Serhiy Storchaka in branch '2.7':
Issue #19936: Added executable bits or shebang lines to Python scripts which
http://hg.python.org/cpython/rev/334116bb2939

--

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



[issue19936] Executable permissions of Python source files

2014-01-16 Thread Stefan Krah

Stefan Krah added the comment:

Somehow Modules/_decimal/tests/bench.py and Modules/_decimal/tests/deccheck.py 
are now executable, which (I think) they should not be.

--
nosy: +skrah

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



[issue20226] Argument Clinic: support for simple expressions?

2014-01-16 Thread Larry Hastings

Larry Hastings added the comment:

Third patch, changes based on Georg's review.  Thanks, Georg!

--
Added file: 
http://bugs.python.org/file33499/larry.clinic.rollup.patch.two.diff.3.txt

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



[issue20226] Argument Clinic: support for simple expressions?

2014-01-16 Thread Larry Hastings

Larry Hastings added the comment:

Sorry, forgot to update trunk, here you go.

--
Added file: 
http://bugs.python.org/file33500/larry.clinic.rollup.patch.two.diff.4.txt

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



[issue20226] Argument Clinic: support for simple expressions?

2014-01-16 Thread Georg Brandl

Georg Brandl added the comment:

Rietveld doesn't like your new patch?

--

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



[issue20226] Argument Clinic: support for simple expressions?

2014-01-16 Thread Georg Brandl

Georg Brandl added the comment:

Thx! (without soundcheck)

--

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



[issue20275] asyncio: remove debug code from BaseEventLoop

2014-01-16 Thread STINNER Victor

STINNER Victor added the comment:

 I don't understand the purpose of these timing information, (...)
 By the way, it's not documentation how to enable asyncio logs

I added a new page in the asyncio documentation to start documenting common 
traps with asynchronous programming and to document debug tools.

I didn't document this specific log discussed in this issue. It may be 
documented in the Handle correctly blocking functions section or it may 
deserve a new section.

Don't hesitate to improve the asyncio documentation!

--

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



[issue20281] time.strftime %z format specifier is the same as %Z

2014-01-16 Thread Mike Owens

New submission from Mike Owens:

When using strftime from the time module on 64bit Python for Windows the format 
specifier %z gives the time zone name instead of the time zone offset as stated 
in the documentation.

eg
 strftime(%z)
'US Mountain Standard Time'
 strftime(%Z)
'US Mountain Standard Time'

The expected output for my time zone is -7:00.

--
components: Library (Lib)
messages: 208295
nosy: Mike.Owens
priority: normal
severity: normal
status: open
title: time.strftime %z format specifier is the same as %Z
type: behavior
versions: Python 3.3

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



[issue20281] time.strftime %z format specifier is the same as %Z

2014-01-16 Thread Mike Owens

Mike Owens added the comment:

Expected output should be -0700.

I checked Python 3.3.1 and 2.7.4 on Linux and the output is as expected.

--

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



[issue19936] Executable permissions of Python source files

2014-01-16 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
stage: patch review - commit review

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



[issue20135] FAQ need list mutation answers

2014-01-16 Thread Fran Bull

Fran Bull added the comment:

I read the FAQ last night and I couldn't see these answered there either. I 
would like to try submitting a patch for this one, probably this evening. It 
will likely be two FAQs in the programming section that go something like:

Why does changing one list change another different list?
This happens:
 a = [1, 2, 3]
 b = a
 b.append(4)
 print a
[1, 2, 3, 4]

because variables are just names for things, in this case 'a' is the list we 
first defined and then b = a says that 'b' is also a name for that list. They 
are both the same list.

Why are my default args wrong?
This happens:

 from datetime import datetime
 class A(object):
...   def __init__(self, created_time=datetime.now()):
... self.created_time = created_time
... 
 an_a = A()
 another_a = A()
 an_a.created_time
datetime.datetime(2014, 1, 16, 10, 40, 54, 33283)
 another_a.created_time
datetime.datetime(2014, 1, 16, 10, 40, 54, 33283)

because default arguments are evaluated when they're read for the first time by 
the interpreter. Usually when the class is imported. A good way to get the 
above to do what you want is to use a default argument of None and check for 
it, like:
 class B(object):
...   def __init__(self, created_time=None):
... if created_time is None:
...   created_time=datetime.now()
... self.created_time = created_time
... 
 a_b = B()
 another_b = B()
 a_b.created_time
datetime.datetime(2014, 1, 16, 10, 44, 44, 956710)
 another_b.created_time
datetime.datetime(2014, 1, 16, 10, 44, 51, 71311)

Feedback appreciated, particularly I'm not sure if this:
'default arguments are evaluated when they're read for the first time by the 
interpreter'
is exactly the right language. I guess I'll look it up.

--
nosy: +Fran.Bull

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



[issue20281] time.strftime %z format specifier is the same as %Z

2014-01-16 Thread R. David Murray

R. David Murray added the comment:

Please see the footnote on the 'time' documentation page.  It sounds like 
Windows is treating %z as if was %Z.

There should be a reference to that footnote from the %z table entry, so that's 
a doc bug.  Might also be worth explicitly mentioning this weird Windows 
behavior.

FYI, you can use the strftime functionality of the datetime module to get cross 
platform %z support.

--
assignee:  - docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python, r.david.murray
stage:  - needs patch
versions: +Python 3.4 -Python 3.3

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



[issue20281] time.strftime %z format specifier is the same as %Z

2014-01-16 Thread Mike Owens

Mike Owens added the comment:

Documentation doesn't have a foot note for either %z or %Z but there is generic 
footnote talking about C lib behavior and that %z is deprecated. I guess if 
there were a foot note in the table for %z that would save some time for 
everyone.

--

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



[issue20281] time.strftime %z format specifier is the same as %Z

2014-01-16 Thread Mike Owens

Mike Owens added the comment:

The datetime.strftime function produces no output for %z or %Z. Very irritating.

--

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



[issue20281] time.strftime %z format specifier is the same as %Z

2014-01-16 Thread SilentGhost

SilentGhost added the comment:

Mike, the note is at the very bottom of the page.

datetime.strftime produces empty strings with this specifiers for naïve 
objects, are the object you're testing timezone-aware?

--
nosy: +SilentGhost

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



[issue20226] Argument Clinic: support for simple expressions?

2014-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset abf87e1fbc62 by Larry Hastings in branch 'default':
Issue #20226: Major improvements to Argument Clinic.
http://hg.python.org/cpython/rev/abf87e1fbc62

--
nosy: +python-dev

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



[issue20226] Argument Clinic: support for simple expressions?

2014-01-16 Thread Larry Hastings

Larry Hastings added the comment:

Done!

Georg: Thanks for the suggestion, and for the reviews!  Argument Clinic is 
improved this day.

--

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



[issue20226] Argument Clinic: support for simple expressions?

2014-01-16 Thread Larry Hastings

Changes by Larry Hastings la...@hastings.org:


--
resolution:  - fixed
stage: patch review - commit review
status: open - closed

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



[issue20282] Argument Clinic: int with boolean default

2014-01-16 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Currently in many functions boolean argument parsed as int, with 'i' code. When 
converting this to Argument Clinic we can't write just

interactive: int = False

because C default becomes Py_False.

Instead we need explicitly specify c_default.

interactive: int(c_default=0) = False

It would be good if True/False default values be converted to 1/0 C default 
values for the int type.

I think this is enough common situation.

--
components: Demos and Tools
messages: 208304
nosy: georg.brandl, larry, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Argument Clinic: int with boolean default
type: enhancement
versions: Python 3.4

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



[issue20135] FAQ need list mutation answers

2014-01-16 Thread R. David Murray

R. David Murray added the comment:

Thanks for working on this.

Technically, defaults are evaluated when the 'def' statement is executed, which 
is normally, but not always, at the time that the module is first imported 
(counterexample: nested function definitions).

The answer should also explicitly cover the more common mistake made with 
default keyword values of passing a mutable object and having it get 
persistently modified,and the question phrasing should reflect that.  The 
datetime example is a great first example before getting to the more common 
one, though.

--

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



[issue19145] Inconsistent behaviour in itertools.repeat when using negative times

2014-01-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Current behaviors 3.4b2
 itertools.repeat('a', -1)
repeat('a', 0)
 itertools.repeat('a', times=-1)
repeat('a')  # forever
 itertools.repeat('a', times=-2)
repeat('a', -2)

My opinions (same as what Raymond says -- negative == 0)
The first line is correct in both behavior and representation.
The second line behavior (and corresponding repr) are wrong.
The third line repr is wrong but the behavior is like the first.

Guido's response on pydev, in context about having a signature that can be 
captured by C and Python. The main different is comment about adding None to 
the C signature in addition to the Python 'equivalent, which has 'times=None'.

If I had complete freedom in redefining the spec I would treat
positional and keyword the same, interpret absent or None to mean
forever and explicit negative integers to mean the same as zero, and
make repr show a positional integer = 0 if the repeat isn't None.

But I don't know if that's too much of a change.

I think the only thing different is comment about None.

--
nosy: +terry.reedy

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



[issue20280] add predicate to the glossary

2014-01-16 Thread Raymond Hettinger

Raymond Hettinger added the comment:

-0 To me, this seems like unnecessary noise.  The more random entries we add to 
the glossary, the less usable it becomes.  There are many computing terms that 
could be added such as recursion, stack overflow, buffer, header, 
packet, basic block, token, sentinel, codec, callback, etc.  We 
could add all of those but it wouldn't make the glossary better; it would just 
make it bigger.

The current glossary strikes pretty good balance but could stand a little 
pruning here and there (i.e. remove the entry for complex number and trim the 
parameter entry back to a sentence or two).

--
nosy: +rhettinger

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



[issue20281] time.strftime %z format specifier is the same as %Z

2014-01-16 Thread R. David Murray

R. David Murray added the comment:

The %z table entry exists only in the 3.4 (dev) docs, not the 3.3 docs.  There 
is no doc change needed for 3.3, since it doesn't mention %z except in the 
footnote.

And yes, I should have mentioned that the datetime versions only work with 
aware timezones.  You can get an aware local time from email.utils.localtime(). 
 (This localtime function may eventually move to
the datetime module if it can be made more reliable, but it works fine for the 
use cases the email package needs.)

--

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



[issue20281] time.strftime %z format specifier is the same as %Z

2014-01-16 Thread Mike Owens

Mike Owens added the comment:

I'm looking right at the 3.3 docs right now. %z is in the table. 

8.1.8. strftime() and strptime() Behavior

--

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



[issue20281] time.strftime %z format specifier is the same as %Z

2014-01-16 Thread R. David Murray

R. David Murray added the comment:

Ah, you are correct.  I'm not sure what page I was looking at before.  Maybe I 
hadn't switched away from the python2 page.

--
versions: +Python 3.3

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



[issue20283] Wrong keyword parameter name in regex pattern methods

2014-01-16 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Documented (in docstring and in ReST documentation) signatures of the match, 
search and (since 3.4) fullmatch methods of regex pattern object are:

match(string[, pos[, endpos]])
search(string[, pos[, endpos]])
fullmatch(string[, pos[, endpos]])

However in implementation the first keyword argument by mistake named 
pattern. This looks as nonsense. The pattern is object itself, and first 
argument is a string. First arguments in other methods (split, findall, etc) 
named string, and module-level functions have both pattern and string 
parameters:

match(pattern, string, flags=0)
search(pattern, string, flags=0)

I think we should fix this mistake. The pattern name is obviously wrong and 
is not match the documentation.

--
components: Library (Lib)
messages: 208311
nosy: ezio.melotti, pitrou, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: Wrong keyword parameter name in regex pattern methods
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4

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



[issue20135] FAQ need list mutation answers

2014-01-16 Thread Fran Bull

Fran Bull added the comment:

Perhaps a 3rd FAQ something like this?:

Why is changing a list in one instance of a class also changing it in another 
instance of the same class?
This happens:
 class A(object):
...   def __init__(self, fruit=[]):
... self.fruit = fruit
... 
 an_A = A()
 an_A.fruit.append('apple')
 another_A = A()
 print another_A.fruit
['apple']
 another_A.fruit.append('banana')
 print another_A.fruit
['apple', 'banana']
 print an_A.fruit
['apple', 'banana']
 print an_A.fruit is another_A.fruit
True
 print an_A.fruit is A().fruit
True

because of a combination of the above two FAQs, first the default argument is 
evaluated when the 'def' statement is executed and creates an instance of list. 
After that new instances of A have a variable 'fruit' that is the name for that 
instance of list.

I'm not sure whether I should be using as general terms as possible for the Q, 
i.e. 'mutable object' instead of 'list'. I'll reread 
http://docs.python.org/devguide/documenting.html and the FAQs before writing 
the patch.

--

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



[issue20284] proof for concept patch for bytes formatting methods

2014-01-16 Thread Neil Schemenauer

New submission from Neil Schemenauer:

This is a very rough, proof of concept patch that implements %-style formatting 
for bytes objects.  Currently it calls __format__ with a bytes argument and 
expects a bytes result.  I've only implemented 
support for bytes formatting for the 'long' object.

Expected behavior:

 b'%s' % b'hello'
b'hello'
 b'%s' % 'hello'
TypeError is raised
 b'%s' % 123
b'123'
 b'%d' % 123
b'123'

Some issues:

- %s support is incomplete, needs to handle width and padding.  I think it 
should be done in formatbytes().

- PyBytes_Format function very likely has bugs, I copied it mostly from Python 
2 and quickly made it run, I did very little testing.

- long__format__ with a bytes argument is inefficient.  It creates temporary 
Python objects that could be avoided.  %-style formatting on bytes will be much 
less efficient than str in Python 2.  We could inline the handling of certain 
types in PyBytes_Format, maybe longs only would be sufficent.

- I'm not sure overloading __format__ is the best approach.  Maybe we should 
introduce a new method, say __ascii__ instead and have PyBytes_Format call that.

--
components: Interpreter Core
files: bytes_mod.patch
keywords: patch
messages: 208313
nosy: nascheme
priority: normal
severity: normal
stage: patch review
status: open
title: proof for concept patch for bytes formatting methods
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file33501/bytes_mod.patch

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



[issue20226] Argument Clinic: support for simple expressions?

2014-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cd3fdf21a6e4 by Larry Hastings in branch 'default':
Issue #20226: Added tests for new features and regressions.
http://hg.python.org/cpython/rev/cd3fdf21a6e4

--

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



[issue19974] tarfile doesn't overwrite symlink by directory

2014-01-16 Thread Chris Morgan

Chris Morgan added the comment:

Testing passed on OSX Mavericks.

--
nosy: +drpotato

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



[issue20189] inspect.Signature doesn't recognize all builtin types

2014-01-16 Thread Larry Hastings

Larry Hastings added the comment:

Whoever does the review, could you post here?  I feel bad enough asking y'all, 
maybe we don't need multiple people doing it ;-)

--

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



[issue20284] proof for concept patch for bytes formatting methods

2014-01-16 Thread Eric V. Smith

Changes by Eric V. Smith e...@trueblade.com:


--
nosy: +eric.smith

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



[issue20285] Improve object.__doc__ and help(object) output

2014-01-16 Thread Terry J. Reedy

New submission from Terry J. Reedy:

 object.__doc__
'The most base type'

Since 'most base' can be interpreted as 'least desireable', several people on 
Python list (2013 Dec, interactive help on the base object) agree that this 
should be improved. Even is 'most base' is interpreted as a value-free 
'bottommost', there is the direction issue. Whether the root of a tree or DAG 
is at top or bottom or side depends on how the graph is drawn. I suggest

The superclass for all Python classes.

===
 help(object)
Help on class object in module builtins:

class object
 |  The most base type
===

I think help(object) should display the methods defined on the object class 
just as it does on all the other classes. The apparent problem is that 
help(subclass) supresses the object methods, but it should not for object 
itself.

--
messages: 208317
nosy: terry.reedy
priority: normal
severity: normal
stage: test needed
status: open
title: Improve object.__doc__ and help(object) output
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4

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



[issue20286] Segfault when using internal DictProxy

2014-01-16 Thread Ali Ebrahim

New submission from Ali Ebrahim:

Demonstration in this gist: https://gist.github.com/aebrahim/840
Crash info in this gist: https://gist.github.com/aebrahim/8466749

The code runs without issue on Ubuntu 12.04 (Python 2.7.3), and Windows 7 
(Python 2.7.6).

It also ran fine on MacOS X 10.8 (Python 2.7.2). However, it failed with MacOX 
X 10.9 for both 2.7.5 (version shipped by Apple) and 2.7.6

Python version information details:
2.7.2
Python 2.7.2 (default, Oct 11 2012, 20:14:37) [GCC 4.2.1 Compatible Apple Clang 
4.0 (tags/Apple/clang-418.0.60)] on darwin

2.7.5
Python 2.7.5 (default, Aug 25 2013, 00:04:04) 
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin

2.7.6
Python 2.7.6 (v2.7.6:3a1db0d2747e, Nov 10 2013, 00:42:54) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin

--
assignee: ronaldoussoren
components: Macintosh
messages: 208318
nosy: Ali.Ebrahim, ronaldoussoren
priority: normal
severity: normal
status: open
title: Segfault when using internal DictProxy
versions: Python 2.7

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



[issue20286] Segfault when using internal DictProxy

2014-01-16 Thread Ali Ebrahim

Changes by Ali Ebrahim aliebrahim...@gmail.com:


--
type:  - crash

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



[issue20286] Segfault when using internal DictProxy

2014-01-16 Thread Vajrasky Kok

Vajrasky Kok added the comment:

It happens on Python 3.3 and 3.4 as well. Tested on Fedora 20.

--
nosy: +vajrasky
versions: +Python 3.3, Python 3.4

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



[issue20286] Segfault when using internal DictProxy

2014-01-16 Thread Benjamin Peterson

Benjamin Peterson added the comment:

s/rettype/restype/ and don't use the internal function _PyObj_FromPointer.

--
nosy: +benjamin.peterson
resolution:  - invalid
status: open - closed

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



[issue8557] subprocess PATH semantics and portability

2014-01-16 Thread Reuben Garrett

Changes by Reuben Garrett reubengarr...@gmail.com:


--
nosy: +RubyTuesdayDONO

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



[issue20189] inspect.Signature doesn't recognize all builtin types

2014-01-16 Thread Nick Coghlan

Nick Coghlan added the comment:

Looking now.

--

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



[issue20135] FAQ need list mutation answers

2014-01-16 Thread Fran Bull

Changes by Fran Bull fran.b...@gmail.com:


--
keywords: +patch
Added file: http://bugs.python.org/file33502/20135.patch

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



[issue20189] inspect.Signature doesn't recognize all builtin types

2014-01-16 Thread Nick Coghlan

Nick Coghlan added the comment:

Larry clarified that the signature(min) change in this patch was actually 
restoring the Python 3.3 behaviour, so I think with the addition of some 
relevant test cases to the test suite, go for it :)

--

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



[issue20086] test_locale fails with Turkish locale

2014-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset bac50f54d357 by Serhiy Storchaka in branch '2.7':
Issue #20086: Restored the use of locale-independing mapping instead of
http://hg.python.org/cpython/rev/bac50f54d357

--

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



[issue1776674] glob.glob inconsistent

2014-01-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Amaury, could you provide corrected patch?

--
components:  -Windows
versions:  -Python 3.2

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



[issue20287] Argument Clinic: support diverting output to buffer, external file, etc

2014-01-16 Thread Larry Hastings

New submission from Larry Hastings:

The long-awaited, highly desirable buffer patch is here!  With features I 
figured would never see the light of day.

Changes in this patch:

* New directive output:
output field destination
  redirects a field (subsection of Clinic's generated code)
  to an alternate destination (someplace besides the output block)
  predefined destinations: block buffer file two-pass suppress

* Alternate use of output:
output preset name
  redirects all destinations en mass based on a precreated scenario
  predefined presets: original file buffer partial-buffer two-pass

* New directive destination:
destination name type [filename]
  creates new destinations for use with output
  valid types: buffer file two-pass suppress

* New directive dump:
dump destination
  dumps the contents of a destination into the current file

* New directive preserve:
preserve
  preserves the current output in an output block (used by file
  destinations)

* New directive set:
   set line_prefix prefix
   set line_suffix suffix

* New output template, uses PyArg_UnpackTuple

* New compact output template, for simple METH_O, only one line

* args and kwargs variables in C renamed to _args and _kwargs

Patch is not ready for checkin, as it still needs documentation.  But it's 
ready for code review!

There's a lot of churn in the C files.  That's due to the following
changes, in order of frequency:

  * args - _args
  * kwargs - _kwargs
  * new concise METH_O template
  * PyArg_UnpackTuple generator

--
assignee: larry
files: larry.clinic.buffer.patch.1.txt
messages: 208325
nosy: georg.brandl, larry, pitrou, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Argument Clinic: support diverting output to buffer, external file, etc
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file33503/larry.clinic.buffer.patch.1.txt

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



[issue20172] Derby #3: Convert 67 sites to Argument Clinic across 4 files (Windows)

2014-01-16 Thread Zachary Ware

Changes by Zachary Ware zachary.w...@gmail.com:


Added file: http://bugs.python.org/file33504/8cf882d09d3f.diff

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



[issue20287] Argument Clinic: support diverting output to buffer, external file, etc

2014-01-16 Thread Zachary Ware

Changes by Zachary Ware zachary.w...@gmail.com:


--
nosy: +zach.ware

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



[issue20172] Derby #3: Convert 67 sites to Argument Clinic across 4 files (Windows)

2014-01-16 Thread Zachary Ware

Changes by Zachary Ware zachary.w...@gmail.com:


Removed file: http://bugs.python.org/file33411/issue20172.winreg.diff

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



[issue20172] Derby #3: Convert 67 sites to Argument Clinic across 4 files (Windows)

2014-01-16 Thread Zachary Ware

Changes by Zachary Ware zachary.w...@gmail.com:


Removed file: http://bugs.python.org/file33412/issue20172.winsound.diff

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



[issue20172] Derby #3: Convert 67 sites to Argument Clinic across 4 files (Windows)

2014-01-16 Thread Zachary Ware

Changes by Zachary Ware zachary.w...@gmail.com:


Removed file: http://bugs.python.org/file33439/issue20172._winapi.diff

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



[issue20172] Derby #3: Convert 67 sites to Argument Clinic across 4 files (Windows)

2014-01-16 Thread Zachary Ware

Changes by Zachary Ware zachary.w...@gmail.com:


Removed file: http://bugs.python.org/file33415/issue20172.msvcrt.diff

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