[issue20075] help(open) eats first line

2014-01-28 Thread Larry Hastings

Larry Hastings added the comment:

Yup, sorry about that.  We're moving pretty fast with the Derby right now, and 
sometimes we don't figure out something important until later, and sometimes 
that means wasted effort.  Sorry!

--

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



[issue20075] help(open) eats first line

2014-01-28 Thread Zachary Ware

Zachary Ware added the comment:

With #20326 fixed, this is no longer an issue.

Gennadiy, thank you for the patch, and I'm sorry it ended up being unused.

--
resolution:  - out of date
stage: commit review - committed/rejected
status: open - closed

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



[issue20075] help(open) eats first line

2014-01-25 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


--
dependencies: +Argument Clinic should use a non-error-prone syntax to mark text 
signatures

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



[issue20075] help(open) eats first line

2014-01-23 Thread Serhiy Storchaka

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


--
nosy: +yselivanov

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



[issue20075] help(open) eats first line

2014-01-21 Thread Serhiy Storchaka

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


--
assignee:  - zach.ware

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



[issue20075] help(open) eats first line

2014-01-21 Thread Stefan Krah

Stefan Krah added the comment:

See also #20326.

--
nosy: +skrah

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



[issue20075] help(open) eats first line

2014-01-20 Thread Zachary Ware

Zachary Ware added the comment:

Gennadiy, sorry this stalled out like it did.

The patched function will be moving as part of issue20189.  Larry, if you want 
to incorporate this patch into that patch, please do so; otherwise I'll get 
this one updated and committed as soon after you commit that one as I can.  
Gennadiy, if you beat me to updating this patch after Larry commits #20189, 
please do so.

(Setting priority as 'critical' since it would be quite embarrassing to release 
3.4.0 with broken help(open).)

--
dependencies: +inspect.Signature doesn't recognize all builtin types
priority: normal - critical

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



[issue20075] help(open) eats first line

2014-01-01 Thread Gennadiy Zlobin

Gennadiy Zlobin added the comment:

Zachary, thank you for review. Here's the updated patch.

--
Added file: http://bugs.python.org/file33292/20075-3.patch

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



[issue20075] help(open) eats first line

2013-12-27 Thread Vajrasky Kok

Vajrasky Kok added the comment:

The patch does not fix it. It becomes like this:

open(...)
Open file and return a stream.  Raise IOError upon failure.

It's not just help(open) has problem, help(sqlite3.connect) got it as well:

connect(...)
check_same_thread, factory, cached_statements, uri])

Opens a connection to the SQLite database file *database*. You can use

--
nosy: +vajrasky

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



[issue20075] help(open) eats first line

2013-12-27 Thread Larry Hastings

Larry Hastings added the comment:

The best fix would be to convert the docstrings to something inspect can parse. 
 Preferably by converting the functions to use Argument Clinic, though you 
could manually mark up the docstring by hand if necessary.

--

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



[issue20075] help(open) eats first line

2013-12-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 The best fix would be to convert the docstrings to something inspect can
 parse.  Preferably by converting the functions to use Argument Clinic,
 though you could manually mark up the docstring by hand if necessary.

We can't check all docstrings in the stdlib and in all third-party libraries.

--

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



[issue20075] help(open) eats first line

2013-12-27 Thread Gennadiy Zlobin

Gennadiy Zlobin added the comment:

Yes, so basically signature line in help(open) is not shown because ast.parse 
fails to parse the return value

- file object

According to grammar, it should be 
- file 
or 
- 'file object' 
or something like this.

as for sqlite, it fails to parse square brackets:

connect(database[, timeout, detect_types, isolation_level,\n\
check_same_thread, factory, cached_statements, uri])

As an idea, maybe we can come up with a failover i.e. if ast can't parse the 
signature, just use __text_signature__ instead of signature object:

Lib/pydoc.py:1325
if not argspec:
-   argspec = '(...)'
+   argspec = object.__text_signature__


Or probably just don't show the signature if it is not formatted correctly as 
it is now (after the patch applied).

--

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



[issue20075] help(open) eats first line

2013-12-27 Thread Zachary Ware

Zachary Ware added the comment:

The patch looks good to me (aside from extra whitespace on the blank lines in 
methodobject.c, and I agree with Serhiy about s/brackets/parens/).  Also, I 
like the suggestion of using __text_signature__ instead of '(...)'.  However, 
just to avoid any possible issues with __text_signature__ being blank or 
missing, I would go with `argspec = getattr(object, '__text_signature__', '') 
or '(...)'` instead of straight `object.__text_signature__` (and note that 
there are two places to change in pydoc).

--

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



[issue20075] help(open) eats first line

2013-12-27 Thread Gennadiy Zlobin

Gennadiy Zlobin added the comment:

Thank you for the comments! I'll update the patch.


BTW is it safe to update Lib/inspect.py:2004 ?

- return cls(parameters, return_annotation=cls.empty)
+ return cls(parameters, return_annotation=f.returns.s or cls.empty)

Looks like the return value is not shown in signature (if it parsed correctly) 
because currently we explicitly pass cls.empty instance, but if we'd pass 
f.returns.s, the return value is shown.

Or it is correct behavior?

--

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



[issue20075] help(open) eats first line

2013-12-27 Thread Gennadiy Zlobin

Gennadiy Zlobin added the comment:

So, looks like it works for me and all tests pass.
Here's a new patch.
Feel free to revert Lib/inspect.py:2004-2009 if this is incorrect behavior.

--
Added file: http://bugs.python.org/file33280/20075-2.patch

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



[issue20075] help(open) eats first line

2013-12-27 Thread Larry Hastings

Larry Hastings added the comment:

One of the relevant PEPs (PEP 8?  PEP 7?  the annotations PEP?) states that the 
Python standard library is not permitted to use annotations.  And considering 
that Argument Clinic is an internal-only tool, we could probably justify the 
decision to not allow annotations to creep through.

That said, I think it's harmless, and it might be useful to somebody, so go 
ahead and propagate the annotation from the __text_signature__ into 
inspect.Signature if we get a valid one.  But please create a separate issue 
for it.  (I encourage you to cut-and-paste this text into the description of 
that new issue.)

--

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



[issue20075] help(open) eats first line

2013-12-27 Thread Gennadiy Zlobin

Gennadiy Zlobin added the comment:

I'm sorry, I'm not sure I caught the idea. So, I need to create an issue with 
description

propagate the annotation from the __text_signature__ into inspect.Signature if 
we get a valid one. ?

--

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



[issue20075] help(open) eats first line

2013-12-26 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

The output of help(open) (and `pydoc open`) in 3.4 is:

Help on built-in function open in module io:

open(...)
errors=None, newline=None, closefd=True, opener=None) - file object

Open file and return a stream.  Raise IOError upon failure.
...

In 3.3 and older it works correctly:

Help on built-in function open in module io:

open(...)
open(file, mode='r', buffering=-1, encoding=None,
 errors=None, newline=None, closefd=True, opener=None) - file object

Open file and return a stream.  Raise IOError upon failure.
...

--
components: Interpreter Core
keywords: 3.3regression
messages: 206962
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: help(open) eats first line
type: behavior
versions: Python 3.4

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



[issue20075] help(open) eats first line

2013-12-26 Thread Zachary Ware

Zachary Ware added the comment:

Interestingly, it doesn't look like pydoc's fault:

P:\ath\to\cpython\PCbuild\python_d.exe -ISc import 
sys;print(sys.version);print(open.__doc__[:75]);print('pydoc' in sys.modules)
3.4.0b1 (default:94a04b8b3a12, Dec 26 2013, 09:27:14) [MSC v.1600 32 bit 
(Intel)]
 errors=None, newline=None, closefd=True, opener=None) - file object


False

--
nosy: +zach.ware

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



[issue20075] help(open) eats first line

2013-12-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Indeed. However in Modules/_io/_iomodule.c:

PyDoc_STRVAR(open_doc,
open(file, mode='r', buffering=-1, encoding=None,\n
 errors=None, newline=None, closefd=True, opener=None) - file object\n
\n
Open file and return a stream.  Raise IOError upon failure.\n
...

Perhaps Larry has relations to this.

--
nosy: +larry

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



[issue20075] help(open) eats first line

2013-12-26 Thread Meador Inge

Meador Inge added the comment:

Looks like the changes from 78ec18f5cb45 attempt to skip the signature,
but can't handle multi-line signatures.

--
nosy: +meador.inge

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



[issue20075] help(open) eats first line

2013-12-26 Thread Gennadiy Zlobin

Gennadiy Zlobin added the comment:

Hi guys,

probably this patch can fix it?

--
keywords: +patch
nosy: +gennad
Added file: http://bugs.python.org/file33276/20075.patch

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



[issue20075] help(open) eats first line

2013-12-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM.

--
stage:  - commit review

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