[issue16731] xxlimited/xxmodule docstrings ambiguous

2015-12-30 Thread Daniel Shahaf

Daniel Shahaf added the comment:

I don't mind at all.  Go ahead :)

--

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



[issue17050] argparse.REMAINDER doesn't work as first argument

2015-09-29 Thread Daniel Shahaf

Changes by Daniel Shahaf :


--
nosy: +danielsh

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



[issue16379] SQLite error code not exposed to python

2015-08-24 Thread Daniel Shahaf

Daniel Shahaf added the comment:

> What's the reasoning behind offering a error code to name mapping?

Allowing code that runs into an error to print the error name rather than its
numeric value.  This saves whoever reads the error message having to look it up
himself.

> his seem problematic to me. In case a newer SQLite version introduces a new
> error code, this error code cannot be found in the mapping. I propose to
> leave this out in order to not have this problem.
> 
> Otherwise we will have people depending on any error code being able to be
> found in this mapping.

Then people shouldn't depend on the mapping being complete.  Let's keep the
mapping and document that people should only use it as
`sqlite3.errorcode.get(...)`, never as `sqlite3.errorcode[...]`.

Or if that's not a good API, we could encapsulate the incompleteness of the
mapping into a small wrapper function:

   def something(errorcode):
   return sqlite3.errorcode.get(errorcode,
"".format(errorcode))

--

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



[issue23802] patch: __deepcopy__ memo dict argument usage

2015-03-28 Thread Daniel Shahaf

New submission from Daniel Shahaf:

In the 'copy' module documentation, it wasn't fully clear to me how 
__deepcopy__ implementations should treat the memo dict argument.  The attached 
patch clarifies that __deepcopy__ implementations should treat the memo dict 
argument as an opaque type.

--
assignee: docs@python
components: Documentation
files: opaque.diff
keywords: patch
messages: 239473
nosy: danielsh, docs@python
priority: normal
severity: normal
status: open
title: patch: __deepcopy__ memo dict argument usage
type: enhancement
Added file: http://bugs.python.org/file38723/opaque.diff

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



[issue14208] No way to recover original argv with python -m

2013-01-13 Thread Daniel Shahaf

Daniel Shahaf added the comment:

Antoine Pitrou wrote on Sun, Jan 13, 2013 at 10:19:20 +:
> 
> Antoine Pitrou added the comment:
> 
> > I'm not seeing a good justification for doing anything more, though:
> > 
> > - needing to access this information is an exceedingly niche use case
> > - I don't see any way for raw_argv to be useful in a cross-implementation 
> > manner.
> 
> I expect it to be useful in the "launch (almost) the same command in the
> same way" situation.
> Not that it happens often :-)

What about the "launch a different command with the same interpreter
flags" use-case?  For example, having 'python -E foo.py --foooptions'
want to execute 'python -E bar.py'.

Perhaps it'll be cleaner to expose in state_argv ['python', '-E']; in
sys.argv ['foo.py', '--foooptions']; and have scripts that want to exec
themselves use an idiomatic os.execv(sys.executable, sys.state_argv + sys.argv).

--

___
Python tracker 
<http://bugs.python.org/issue14208>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2209] mailbox module doesn't support compressed mbox

2013-01-12 Thread Daniel Shahaf

Changes by Daniel Shahaf :


--
nosy: +danielsh

___
Python tracker 
<http://bugs.python.org/issue2209>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14208] No way to recover original argv with python -m

2013-01-12 Thread Daniel Shahaf

Changes by Daniel Shahaf :


--
nosy: +danielsh

___
Python tracker 
<http://bugs.python.org/issue14208>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10544] yield expression inside generator expression does nothing

2013-01-12 Thread Daniel Shahaf

Changes by Daniel Shahaf :


--
nosy: +danielsh

___
Python tracker 
<http://bugs.python.org/issue10544>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16076] xml.etree.ElementTree.Element is no longer pickleable

2013-01-11 Thread Daniel Shahaf

Daniel Shahaf added the comment:

Ezio Melotti wrote on Fri, Jan 11, 2013 at 08:44:43 +:
> >>> ### one ref leaked for every child in __setstate__:
> >>> e2.__setstate__(p2)
> [76810 refs]
> >>> e2.__setstate__(p2)
> [76813 refs]
> >>> e2.__setstate__(p2)
> [76816 refs]
> 
> I'm not working on this anymore now, so someone more familiar with the
> code can take a look, see if my patch is correct, and fix the
> remaining leaks.
> 

Thank for narrowing it down so much.  Attached patch incorporates your
getstate fix and a fix for setstate.  It passes the -R 3:2 tests.

--
Added file: http://bugs.python.org/file28691/memleak-v1.diff

___
Python tracker 
<http://bugs.python.org/issue16076>
___diff -r 6eae84170536 Modules/_elementtree.c
--- a/Modules/_elementtree.cFri Jan 11 10:49:43 2013 +0100
+++ b/Modules/_elementtree.cFri Jan 11 10:56:05 2013 +
@@ -859,8 +859,10 @@ element_getstate(ElementObject *self)
  PICKLED_ATTRIB, self->extra->attrib,
  PICKLED_TEXT, self->text,
  PICKLED_TAIL, self->tail);
-if (instancedict)
+if (instancedict) {
+Py_DECREF(children);
 return instancedict;
+}
 else {
 for (i = 0; i < PyList_GET_SIZE(children); i++)
 Py_DECREF(PyList_GET_ITEM(children, i));
@@ -884,25 +886,17 @@ element_setstate_from_attributes(Element
 PyErr_SetString(PyExc_TypeError, "tag may not be NULL");
 return NULL;
 }
-if (!text) {
-Py_INCREF(Py_None);
-text = Py_None;
-}
-if (!tail) {
-Py_INCREF(Py_None);
-tail = Py_None;
-}
 
 Py_CLEAR(self->tag);
 self->tag = tag;
 Py_INCREF(self->tag);
 
 Py_CLEAR(self->text);
-self->text = text;
+self->text = text ? text : Py_None;
 Py_INCREF(self->text);
 
 Py_CLEAR(self->tail);
-self->tail = tail;
+self->tail = tail ? tail : Py_None;
 Py_INCREF(self->tail);
 
 /* Handle ATTRIB and CHILDREN. */

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



[issue16076] xml.etree.ElementTree.Element is no longer pickleable

2013-01-08 Thread Daniel Shahaf

Daniel Shahaf added the comment:

v8 removes TreeBuilder handling (code + tests) and removes memcpy per review.  
(Outstanding issues in the review can be fixed post-v8, if needed.)

--
Added file: http://bugs.python.org/file28639/i16076-v8.diff

___
Python tracker 
<http://bugs.python.org/issue16076>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16076] xml.etree.ElementTree.Element is no longer pickleable

2013-01-08 Thread Daniel Shahaf

Daniel Shahaf added the comment:

Dissociating TreeBuilder from this issue per recent comments.

--
title: xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are 
no longer pickleable -> xml.etree.ElementTree.Element is no longer pickleable

___
Python tracker 
<http://bugs.python.org/issue16076>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16076] xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no longer pickleable

2013-01-08 Thread Daniel Shahaf

Daniel Shahaf added the comment:

Eli Bendersky wrote on Tue, Jan 08, 2013 at 15:00:42 +:
> 
> Eli Bendersky added the comment:
> 
> P = import_fresh_module('xml.etree.ElementTree', blocked=['_elementtree'])
> tb = P.TreeBuilder(element_factory=lambda a, b: [a, b])
> print(pickle.dumps(tb))
> 
> Gives: _pickle.PicklingError: Can't pickle : attribute 
> lookup builtins.function failed

Is that with or without the patch?

--

___
Python tracker 
<http://bugs.python.org/issue16076>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16076] xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no longer pickleable

2013-01-07 Thread Daniel Shahaf

Daniel Shahaf added the comment:

New iteration.

Open issues:

- Share code with the init method.  The issue with sharing code with either 
element_init() or create_new_element() would be malloc+realloc: unlike either 
of these methods, we know both the attributes and the number of children at 
allocation time, so we can allocate directly the right number of children.

- C<->Py Interchangeable pickling of TreeBuilder (per above msg).

Differences to previous version:

- Skip C<->Py interchangeability testing of TreeBuilder --- because that one 
started failing with:
  _pickle.UnpicklingError: state is not a dictionary
  It can probably be fixed, but I'd like to address the above question about 
pickling the factory first.

- Use __getstate__ rather than __reduce__ for Element.

- Make Element pickling interchangeable between c/py Element
  (set tp_name to "xml.etree.ElementTree.Element" and match the
  pickled format).

--
Added file: http://bugs.python.org/file28627/i16076-v7.diff

___
Python tracker 
<http://bugs.python.org/issue16076>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16076] xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no longer pickleable

2013-01-07 Thread Daniel Shahaf

Daniel Shahaf added the comment:

In the meantime, unrelated question: should TreeBuilder be pickleable too, and 
interchangeably (pickle|unpickle)able between the Python and C implementations? 
 Asking because the Python TreeBuilder has a _factory member which it 
initializes to 'Element', and I'm not quite sure how cross-pickling should 
handle that.

--

___
Python tracker 
<http://bugs.python.org/issue16076>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16076] xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no longer pickleable

2013-01-06 Thread Daniel Shahaf

Daniel Shahaf added the comment:

Eli Bendersky wrote on Thu, Jan 03, 2013 at 14:44:02 +:
> If this change is required (even if we choose to name it
> "xml.etree.ElementTree.Element" for Py compatibility to fix the pickling
> regression, we may find ourselves in a need to change it between 3.3 and
> 3.3.1 and I'm not sure if that's valid. I hope my question on pydev will be
> resolved conclusively.
> 
> Danial, could you investigate if such a change is absolutely required to
> make pickling/unickling of Element work?

There are a few options:

- Change c-Element's tp_name to "xml.etree.ElementTree.Element".

- Register a reduce function for c-Element's that serialises them by
  constructing an equivalent py-Element and returning the latter's
  .__dict__ via the third return value:
  http://docs.python.org/3/library/copyreg#copyreg.pickle

- Add an entry mapping "builtins.Element" to
  "xml.etree.ElementTree.Element" to _compat_pickle.IMPORT_MAPPING
  (which is used by Lib/pickle.py:_Pickler.find_class()).

I haven't tried to implement either of these approaches.

--

___
Python tracker 
<http://bugs.python.org/issue16076>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16808] inspect.stack() should return list of named tuples

2013-01-04 Thread Daniel Shahaf

Changes by Daniel Shahaf :


Added file: http://bugs.python.org/file28572/inspect-v5.diff

___
Python tracker 
<http://bugs.python.org/issue16808>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16808] inspect.stack() should return list of named tuples

2013-01-04 Thread Daniel Shahaf

Changes by Daniel Shahaf :


Removed file: http://bugs.python.org/file28571/inspect-v4.diff

___
Python tracker 
<http://bugs.python.org/issue16808>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16808] inspect.stack() should return list of named tuples

2013-01-04 Thread Daniel Shahaf

Daniel Shahaf added the comment:

Terry J. Reedy wrote on Sat, Jan 05, 2013 at 01:33:50 +:
> Should a test be added to or changed in test_inspect? Line 163 has
> a test_stack method that calls inspect.stack.

Makes sense; added a test that tests named attribute access.  Thanks for
the pointer.

--
Added file: http://bugs.python.org/file28571/inspect-v4.diff

___
Python tracker 
<http://bugs.python.org/issue16808>
___diff -r 4b42d7f288c5 Doc/library/inspect.rst
--- a/Doc/library/inspect.rst   Thu Jan 03 09:22:41 2013 +0100
+++ b/Doc/library/inspect.rst   Sat Jan 05 04:06:25 2013 +
@@ -800,11 +800,17 @@ Classes and functions
 The interpreter stack
 -
 
-When the following functions return "frame records," each record is a tuple of
-six items: the frame object, the filename, the line number of the current line,
+When the following functions return "frame records," each record is a
+:term:`named tuple`
+``FrameInfo(frame, filename, lineno, function, code_context, index)``.
+The tuple contains the frame object, the filename, the line number of the
+current line,
 the function name, a list of lines of context from the source code, and the
 index of the current line within that list.
 
+.. versionchanged:: 3.3
+   Return a named tuple instead of a tuple.
+
 .. note::
 
Keeping references to frame objects, as found in the first element of the 
frame
diff -r 4b42d7f288c5 Lib/inspect.py
--- a/Lib/inspect.pyThu Jan 03 09:22:41 2013 +0100
+++ b/Lib/inspect.pySat Jan 05 04:06:25 2013 +
@@ -1139,6 +1139,8 @@ def getlineno(frame):
 # FrameType.f_lineno is now a descriptor that grovels co_lnotab
 return frame.f_lineno
 
+FrameInfo = namedtuple('FrameInfo', ('frame',) + Traceback._fields)
+
 def getouterframes(frame, context=1):
 """Get a list of records for a frame and all higher (calling) frames.
 
@@ -1146,7 +1148,8 @@ def getouterframes(frame, context=1):
 name, a list of lines of context, and index within the context."""
 framelist = []
 while frame:
-framelist.append((frame,) + getframeinfo(frame, context))
+frameinfo = (frame,) + getframeinfo(frame, context)
+framelist.append(FrameInfo(*frameinfo))
 frame = frame.f_back
 return framelist
 
@@ -1157,7 +1160,8 @@ def getinnerframes(tb, context=1):
 name, a list of lines of context, and index within the context."""
 framelist = []
 while tb:
-framelist.append((tb.tb_frame,) + getframeinfo(tb, context))
+frameinfo = (tb.tb_frame,) + getframeinfo(tb, context)
+framelist.append(FrameInfo(*frameinfo))
 tb = tb.tb_next
 return framelist
 
diff -r 4b42d7f288c5 Lib/test/test_inspect.py
--- a/Lib/test/test_inspect.py  Thu Jan 03 09:22:41 2013 +0100
+++ b/Lib/test/test_inspect.py  Sat Jan 05 04:06:25 2013 +
@@ -170,6 +170,8 @@ class TestInterpreterStack(IsTestBase):
  (modfile, 43, 'argue', ['spam(a, b, c)\n'], 0))
 self.assertEqual(revise(*mod.st[3][1:]),
  (modfile, 39, 'abuse', ['self.argue(a, b, c)\n'], 0))
+self.assertEqual(mod.st[0].frame, mod.fr)
+self.assertEqual(mod.st[0].lineno, 16)
 
 def test_trace(self):
 self.assertEqual(len(git.tr), 3)
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16076] xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no longer pickleable

2013-01-03 Thread Daniel Shahaf

Daniel Shahaf added the comment:

Eli Bendersky wrote on Thu, Jan 03, 2013 at 14:44:02 +:
> On Tue, Jan 1, 2013 at 2:56 PM, Daniel Shahaf wrote:
> > I added the "_elementtree" to the tp_name in order to bypass the above
> > error.  Module-qualified names were in use elsewhere (including by
> > _elementtree._element_iterator) so it seemed reasonable.  I'll defer to
> > you about compatibility implications of this change.
> 
> I asked on pydev, but this is a key point to resolve. Can
> pickling/unpickling be made to work correctly without such (or similar)
> change at all? How will the unpickler know which module to load when it
> sees a pickled object of Element type?

Is there a requirement that it loads a particular module?  Would etree
users notice the difference if pickle.load() returns an instance of the
"other" Element implementation than the one they pickled?

> Danial, could you investigate if such a change is absolutely required to
> make pickling/unickling of Element work?

Yes, I'll look into that.

--

___
Python tracker 
<http://bugs.python.org/issue16076>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16076] xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no longer pickleable

2013-01-01 Thread Daniel Shahaf

Daniel Shahaf added the comment:

Also, the class inheritance in the tests should be amended to follow #16835.

--

___
Python tracker 
<http://bugs.python.org/issue16076>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16076] xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no longer pickleable

2013-01-01 Thread Daniel Shahaf

Daniel Shahaf added the comment:

Eli Bendersky wrote on Tue, Jan 01, 2013 at 00:32:51 +:
> 1. Why did you choose to implement __reduce__ and not __getstate__?

Maybe I was simply imitating what some other extension module was doing ;)

By using __reduce__ with the type as first return value, the
__setstate__ code becomes simpler because it doesn't need to address
'tag' and 'attrib'.  This consideration is somewhat moot now that the
unpickle-Python-pickled-Element's code path has to think about all
instance attributes, including those settable by the constructor.

> 2. A lot of code appears to be shared between
> element_setstate_from_attributes and the init method implementation,
> can it be refactored?

It seems there might be room for code reuse --- both functions set
tag,text,tail,attrib (but the unpickler sets the children too).  I'll
look into that in the next iteration (once the class name and pickle
output format issues are settled).

--

___
Python tracker 
<http://bugs.python.org/issue16076>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16076] xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no longer pickleable

2013-01-01 Thread Daniel Shahaf

Daniel Shahaf added the comment:

Eli Bendersky wrote on Tue, Jan 01, 2013 at 15:54:00 +:
> Why did you change the class name, by the way, I don't think it's
> a valid change at least for 3.3 in terms of backwards compatibility.
> 

With unmodified tip of 3.4:

>>> import pickle, xml.etree.ElementTree as ET
>>> pickle.dumps(ET.Element('foo'))
Traceback (most recent call last):
  File "", line 1, in 
_pickle.PicklingError: Can't pickle : attribute lookup 
builtins.Element failed

I added the "_elementtree" to the tp_name in order to bypass the above
error.  Module-qualified names were in use elsewhere (including by
_elementtree._element_iterator) so it seemed reasonable.  I'll defer to
you about compatibility implications of this change.

> Regarding that compatibility, and even easier idea would be for the
> C pickle to return the same __dict__ implicitly gathered from the
> Python version, and then only one version of the unpickle is required.

That makes sense.  But going forward it might be even better to define
an explicit __reduce__/__getstate__ for the Python version too, so if
the instance dict grows new members, they won't get serialised
unintentionally.  (This consideration is also why C code in the latest
patch makes some effort to notice unknown args in the dict.)

--

___
Python tracker 
<http://bugs.python.org/issue16076>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9334] argparse does not accept options taking arguments beginning with dash (regression from optparse)

2012-12-31 Thread Daniel Shahaf

Changes by Daniel Shahaf :


--
nosy: +danielsh

___
Python tracker 
<http://bugs.python.org/issue9334>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16808] inspect.stack() should return list of named tuples

2012-12-31 Thread Daniel Shahaf

Daniel Shahaf added the comment:

Fixed that in v3.

--
Added file: http://bugs.python.org/file28515/inspect-v3.diff

___
Python tracker 
<http://bugs.python.org/issue16808>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7735] socket.create_connection() creates IPv6 DNS requests even when built with --disable-ipv6

2012-12-30 Thread Daniel Shahaf

Daniel Shahaf added the comment:

Victor, thanks for the summary.  I view things a little differently, so I'll 
offer my POV:

1. The OPs (Evan and Ralf) build with --disable-ipv6.
2. --disable-ipv6 disables support for IPv6 sockets.  (as per Martin, and AFAIK 
as per the common meaning of that flag in other configure scripts.)  It does 
not disable  DNS queries in stdlib DNS client modules.  It does not disable 
IPv6 support in the 'ipaddress' module.  It does not signify that IPv6 is/isn't 
supported by libc.  It is orthogonal to whether any interface has IPv6 
addresses configured.
3. socket.create_connection() requests IPv6 addresses when Python was built 
with --disable-ipv6.
4. The OPs claim that (3) is a bug, reasoning that, as create_connection() 
should not try to connect(2) to IPv6 addresses (per (2)), it's pointless, 
wasteful, or wrong for it to request them in the first place.
5. Ralf provided a one-line patch for (4):
https://github.com/SiteSupport/gevent/commit/9b1bccffc11455112076189f35023291cf97a2a2

In other words, the issue revolves around configuring Python not to create IPv6 
sockets on IPv6-capable systems.

HTH

--
nosy: +danielsh

___
Python tracker 
<http://bugs.python.org/issue7735>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7735] socket.create_connection() creates IPv6 DNS requests even when built with --disable-ipv6

2012-12-30 Thread Daniel Shahaf

Changes by Daniel Shahaf :


--
title: python creates IPv6 DNS requests even when built with --disable-ipv6 -> 
socket.create_connection() creates IPv6 DNS requests even when built with 
--disable-ipv6

___
Python tracker 
<http://bugs.python.org/issue7735>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16076] xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no longer pickleable

2012-12-30 Thread Daniel Shahaf

Daniel Shahaf added the comment:

BTW, maybe I'm just confused, but I'm a little surprised that C pickling -> 
Python unpickling works: the C __reduce__ returns a 3-element tuple, which 
according to pickle docs[1] must either be a dictionary or be passed to 
__setstate__; it's not a dictionary and the Python implementation doesn't have 
a __setstate__.

http://docs.python.org/3/library/pickle#pickle.object.__reduce__

--

___
Python tracker 
<http://bugs.python.org/issue16076>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16076] xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no longer pickleable

2012-12-30 Thread Daniel Shahaf

Daniel Shahaf added the comment:

Attached.  Differences to previous version:

- Avoid the test___all__ issue (#16817) by manipulating sys.modules
  directly

- Support pickling interoperability between the C and Python
  implementations

--
Added file: http://bugs.python.org/file28502/i16076-v6.diff

___
Python tracker 
<http://bugs.python.org/issue16076>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16379] SQLite error code not exposed to python

2012-12-30 Thread Daniel Shahaf

Daniel Shahaf added the comment:

New patch fixing indentation of versionadded markup.

--
Added file: http://bugs.python.org/file28497/i16379-v3.diff

___
Python tracker 
<http://bugs.python.org/issue16379>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16379] SQLite error code not exposed to python

2012-12-30 Thread Daniel Shahaf

Daniel Shahaf added the comment:

A couple of random eyebrow-raisers I noticed while working on v2:

- sqlite3.Warning is a subclass of Exception, rather than sqlite3.Error
  or builtins.Warning.  (Also, the docs say "will raise a Warning",
  intending to refer to sqlite3.Warning, but the lack of markup makes
  this ambiguous --- it would be interpreted as a reference to
  builtins.Warning).

- If _PyUnicode_AsStringAndSize() returns NULL, the code sets a
  sqlite3.Warning exception without first checking what exception is
  already set.  (grep for PYSQLITE_SQL_WRONG_TYPE)

--

___
Python tracker 
<http://bugs.python.org/issue16379>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16379] SQLite error code not exposed to python

2012-12-30 Thread Daniel Shahaf

Daniel Shahaf added the comment:

New patch, with better docs and less error leaks, per Ezio's review.

--
Added file: http://bugs.python.org/file28496/i16379-v2.diff

___
Python tracker 
<http://bugs.python.org/issue16379>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16808] inspect.stack() should return list of named tuples

2012-12-29 Thread Daniel Shahaf

Daniel Shahaf added the comment:

Add versionchanged per review.

--
keywords: +patch
Added file: http://bugs.python.org/file28488/inspect-v2.diff

___
Python tracker 
<http://bugs.python.org/issue16808>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16817] test___all__ has to save and restore sys.modules while it does all the importing

2012-12-29 Thread Daniel Shahaf

Changes by Daniel Shahaf :


--
nosy: +danielsh

___
Python tracker 
<http://bugs.python.org/issue16817>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15083] Rewrite ElementTree tests in a cleaner and safer way

2012-12-29 Thread Daniel Shahaf

Changes by Daniel Shahaf :


--
nosy: +danielsh

___
Python tracker 
<http://bugs.python.org/issue15083>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16076] xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no longer pickleable

2012-12-29 Thread Daniel Shahaf

Daniel Shahaf added the comment:

Any attempt to pickle an Element object in test_xml_etree.py causes that test 
to fail if test___all__ had been run before it; see attached transcript.  It's 
against 3.4, with no changes other than the testsuite changes shown within.

I don't know what the root cause is.  As noted before, adding 'xml.etree' to 
test___all__.AllTest.test_all.blacklist is a workaround, so I assume the root 
cause lies within the test framework --- a bad interaction between the import 
magics in test___all__ and test_xml_etree.

--
Added file: http://bugs.python.org/file28484/transcript-test___all__.txt

___
Python tracker 
<http://bugs.python.org/issue16076>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16076] xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no longer pickleable

2012-12-29 Thread Daniel Shahaf

Daniel Shahaf added the comment:

I wrote the patch against default (3.4), but it applies cleanly to 3.3.

--

___
Python tracker 
<http://bugs.python.org/issue16076>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16808] inspect.stack() should return list of named tuples

2012-12-29 Thread Daniel Shahaf

Daniel Shahaf added the comment:

Why did you set stage to 'needs patch'?  One is already attached.

--

___
Python tracker 
<http://bugs.python.org/issue16808>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16808] inspect.stack() should return list of named tuples

2012-12-28 Thread Daniel Shahaf

New submission from Daniel Shahaf:

Currently inspect.stack() returns a list of 6-tuples.  I suggest to make it 
return a list of named tuples, so code that only needs one tuple element can 
get it by name.

Current behaviour:
% ./python -c 'import inspect; print(inspect.stack()[0])' 
(, '', 1, '', None, None)

Suggested behaviour:
% ./python -c 'import inspect; print(inspect.stack()[0])'
FrameInfo(frame=, filename='', lineno=1, 
function='', code_context=None, index=None)

--
components: Library (Lib)
files: inspect-v1.diff
keywords: patch
messages: 178467
nosy: danielsh
priority: normal
severity: normal
status: open
title: inspect.stack() should return list of named tuples
versions: Python 3.4
Added file: http://bugs.python.org/file28475/inspect-v1.diff

___
Python tracker 
<http://bugs.python.org/issue16808>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16379] SQLite error code not exposed to python

2012-12-28 Thread Daniel Shahaf

Daniel Shahaf added the comment:

I didn't compile-test the Doc/ part of the patch.

--

___
Python tracker 
<http://bugs.python.org/issue16379>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16379] SQLite error code not exposed to python

2012-12-28 Thread Daniel Shahaf

Daniel Shahaf added the comment:

Attached patch that:

- Adds sqlite3.SQLITE_OK constants
- Adds sqlite3.errorcode dictionary
- Adds "sqlite_errcode" attribute to sqlite.Error instances

The patch does not add support for extended result codes
(http://www.sqlite.org/c3ref/c_abort_rollback.html).

--
keywords: +patch
Added file: http://bugs.python.org/file28470/i16379-v1.diff

___
Python tracker 
<http://bugs.python.org/issue16379>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16379] SQLite error code not exposed to python

2012-12-28 Thread Daniel Shahaf

Changes by Daniel Shahaf :


--
nosy: +danielsh

___
Python tracker 
<http://bugs.python.org/issue16379>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16731] xxlimited/xxmodule docstrings ambiguous

2012-12-21 Thread Daniel Shahaf

Daniel Shahaf added the comment:

Re the review, yes there is a typo in the comment: the comment in xxlimited.c 
should say "xxmodule.c" rather than "xxlimited.c".  (Got a traceback from the 
review app)

--

___
Python tracker 
<http://bugs.python.org/issue16731>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16732] setup.py support for xxmodule without tkinker

2012-12-19 Thread Daniel Shahaf

New submission from Daniel Shahaf:

In setup.py, the logic or enabling xxmodule/xxlimited is currently in 
detect_tkinker(), so it's not run when one of the 'return' statements in the 
latter is executed.  On a box without tk installed, xxmodule.o gets built with 
the attached patch but not without.

--
components: Build
files: setupxxmodule.diff
keywords: patch
messages: 15
nosy: danielsh
priority: normal
severity: normal
status: open
title: setup.py support for xxmodule without tkinker
versions: Python 3.4
Added file: http://bugs.python.org/file28368/setupxxmodule.diff

___
Python tracker 
<http://bugs.python.org/issue16732>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16731] xxlimited/xxmodule docstrings ambiguous

2012-12-19 Thread Daniel Shahaf

New submission from Daniel Shahaf:

Tweak the docstrings of xxmodule and xxlimited to clarify the difference 
between them (as derived from setup.py).  While at it also add a defensive 
coding guard to xxlimited to ensure it remains Py_LIMITED_API-safe.

--
assignee: docs@python
components: Documentation, Extension Modules
files: xxdocstrings.diff
keywords: patch
messages: 14
nosy: danielsh, docs@python
priority: normal
severity: normal
status: open
title: xxlimited/xxmodule docstrings ambiguous
versions: Python 3.4
Added file: http://bugs.python.org/file28367/xxdocstrings.diff

___
Python tracker 
<http://bugs.python.org/issue16731>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16076] xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no longer pickleable

2012-12-19 Thread Daniel Shahaf

Daniel Shahaf added the comment:

Re the problem from msg 177134 ('./python -mtest test___all__ test_xml_etree' 
failing), it is a a preexisting problem, in the sense that applying just the 
Lib/test/ part of this patch suffices to trigger it.  Adding 'xml.etree' to the 
blacklist in test___all__.py:50 suffices to address the problem.  At a guess 
that is because when test___all__ imports the 'xml.etree' module, it doesn't 
filter out the '_elementtree' symbol like test_xml_etree.py:test_main() does.

New patch attached; differences to previous version:

- Removed debug prints.
- Skip test_pickling when testing the Python xml.etree.
  (The skips could be removed in the future, if/when the test___all__
  interaction problem is resolved.)

--
Added file: http://bugs.python.org/file28363/i16076-v5.diff

___
Python tracker 
<http://bugs.python.org/issue16076>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16076] xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no longer pickleable

2012-12-16 Thread Daniel Shahaf

Daniel Shahaf added the comment:

Haven't had a chance to look at the test___all__ -related failures yet.  Still 
planning to do so once I have some time.

--

___
Python tracker 
<http://bugs.python.org/issue16076>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16076] xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no longer pickleable

2012-12-08 Thread Daniel Shahaf

Daniel Shahaf added the comment:

@Eli, thanks.  In the meantime, attaching a patch addressing Ezio's review; the 
caveats from msg 177134 still apply.

--
Added file: http://bugs.python.org/file28261/i16076-v4-combined.diff

___
Python tracker 
<http://bugs.python.org/issue16076>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16076] xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no longer pickleable

2012-12-07 Thread Daniel Shahaf

Changes by Daniel Shahaf :


Removed file: http://bugs.python.org/file28251/i16076-v2-combined.diff

___
Python tracker 
<http://bugs.python.org/issue16076>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16076] xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no longer pickleable

2012-12-07 Thread Daniel Shahaf

Daniel Shahaf added the comment:

Reattaching without the unrelated Python-ast.c change.

--
Added file: http://bugs.python.org/file28252/i16076-v3-combined.diff

___
Python tracker 
<http://bugs.python.org/issue16076>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16076] xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no longer pickleable

2012-12-07 Thread Daniel Shahaf

Daniel Shahaf added the comment:

TreeBuilder was also pickleable in 3.2 but now isn't so; updating summary 
accordingly.

Attaching a checkpoint patch.  It addresses both Element and TreeBuilder, and 
adds tests.  The added tests fail if test___all__ is included in the test run, 
so the patch should not be applied as-is.

Thanks to Ezio Melotti for preliminary review and suggestions on IRC.

--
title: xml.etree.ElementTree.Element is no longer pickleable -> 
xml.etree.ElementTree.Element and xml.etree.ElementTree.TreeBuilder are no 
longer pickleable
Added file: http://bugs.python.org/file28251/i16076-v2-combined.diff

___
Python tracker 
<http://bugs.python.org/issue16076>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16076] xml.etree.ElementTree.Element is no longer pickleable

2012-12-03 Thread Daniel Shahaf

Daniel Shahaf added the comment:

Attached patch for your consideration.

I've tested pickling/unpickling and comparing the resulting object attribute by 
attribute (.tag, .attrib, .text, .tail for equality; and recursively 
.getchildren()), and 'make test' --- all seems to work.

If the approach is sound, I can submit a revised patch that also updates 
documentation, regression tests, and potententially updates other type objects 
in the same manner as this patch updates _elementtree.Element .

--
components: +Extension Modules
keywords: +patch
nosy: +danielsh
Added file: http://bugs.python.org/file28199/i16076-cpatch.diff

___
Python tracker 
<http://bugs.python.org/issue16076>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16593] Have BSD 'make -s' DTRT

2012-12-01 Thread Daniel Shahaf

Changes by Daniel Shahaf :


--
keywords: +patch
Added file: http://bugs.python.org/file28182/makedashs.diff

___
Python tracker 
<http://bugs.python.org/issue16593>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16593] Have BSD 'make -s' DTRT

2012-12-01 Thread Daniel Shahaf

New submission from Daniel Shahaf:

FreeBSD make sets $$MAKEFLAGS differently than GNU make does.  Attached patch 
updates Makefile.pre.in to recognise that syntax too.

Preliminary versions discussed with Crys on #python-dev.

--
components: Build
messages: 176768
nosy: danielsh
priority: normal
severity: normal
status: open
title: Have BSD 'make -s' DTRT
type: enhancement
versions: Python 3.4

___
Python tracker 
<http://bugs.python.org/issue16593>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com