Larry Hastings added the comment:
The construction of release.py would make it easy to just always pass it in
when running Python (and hg, and any program). Maybe that's a better choice.
--
___
Python tracker
<http://bugs.python.org/is
Larry Hastings added the comment:
I don't understand the problem--you didn't give me enough context. Can you
attach a file that demonstrates the problem?
--
___
Python tracker
<http://bugs.python.o
Larry Hastings added the comment:
Does your proposed solution work properly when docstrings are turned off? Try
undefining WITH_DOC_STRINGS. I bet you need to make the size 1 in that case.
Also, the length must be len(f.docstring) + 1, to account for the trailing \0.
Also, error C2133
Larry Hastings added the comment:
Serhiy: PyDoc_VAR is used in the "two-pass" approach as a forward declaration
for docstrings. Imagine if, in winsound.c, sound_methods was defined above the
"dump buffer" block. The expansion of WINSOUND_PLAYSOUND_METHODDEF would
in
Larry Hastings added the comment:
If you want to make sure that happens, please review my next patch for #20189,
or fix it after that patch goes in if I forget. (Honestly it's hard for me to
keep track of everything right now.)
--
resolution: -> duplicate
stage: ->
Larry Hastings added the comment:
Argh. I lost 1.5 day's worth of work on revision 6 of this patch last
night, due to me being tired and over-aggressively cleaning my working
directories. I will have to reconstruct it from memory, hopefully
Tuesday. (I basically know what I did, and
New submission from Larry Hastings:
Sorry this is so long--but I wanted to make my point. Here's the tl;dr summary.
The problem: The syntax used for Argument-Clinic-generated text
signatures for builtins means CPython mistakenly identifies
hand-written, unparsable pseudo-signatur
Larry Hastings added the comment:
Confirmed, and yes it's low priority.
--
___
Python tracker
<http://bugs.python.org/issue20303>
___
___
Python-bugs-list m
Larry Hastings added the comment:
If in C you define
static char a[5] = "abcde"
C suppresses the trailing '\0'. That it continued to work okay was a lucky
break--you must not have looked in many docstrings, or you lucked out and they
happened to b
Larry Hastings added the comment:
I had to throw it in a struct to prevent gcc from rearranging the variables.
But this demonstrates the problem--when it prints the string, it doesn't stop
at the end.
-
#include
typedef struct
{
int a;
char b[8];
int c;
}
Larry Hastings added the comment:
Serhiy: I'm going to add PEP 457 features to the text signature, because
without them the inspect.Signature objects will be wrong. So __doc__ and
__text_signature__ would have to remove those first before handing the string
to ast.parse.
I wasn't
Larry Hastings added the comment:
/*[clinic input]
brett_is_stinky_and_wrong
l: long
[clinic start generated code]*/
PyDoc_STRVAR(brett_is_stinky_and_wrong__doc__,
"brett_is_stinky_and_wrong(l)");
#define BRETT_IS_STINKY_AND_WRONG_METHODDEF\
{"brett_is_s
Larry Hastings added the comment:
Is this waiting on something? I agree that we can't change the behavior
of existing functions. But your new converters should raise ValueError.
--
___
Python tracker
<http://bugs.python.org/is
Larry Hastings added the comment:
Also, you didn't remove the _ in front of "Converter" in the names, e.g
"_PyLong_UnsignedShort_Converter" should be "_PyLong_UnsignedShortConverter".
--
___
Python tracker
Larry Hastings added the comment:
Actually, here's another data point to consider. The underlying implementation
of PyArg_Parse* is the function convertsimple() in Python/getargs.c. For all
the non-bitwise integer format units ('bhi'), if they overflow or underflow the
nati
Larry Hastings added the comment:
Well, they're going to have to change somehow, because the concepts of "left"
and "right" are going away (see #20303). However, your suggested new name for
these functions would be awful for large groups. Consider
curses.window
Larry Hastings added the comment:
When I fix #20303, the new rules will be:
* You can have top-level optional groups anywhere.
* You may nest up to one nested group in a group.
* Whenever you nest a group in another group, all nested groups in that
stack must favor the same side (left or right
Larry Hastings added the comment:
That problem will be irrelevant, once builtin classes support signatures
(#20189).
--
___
Python tracker
<http://bugs.python.org/issue20
New submission from Larry Hastings:
Attached is a *preliminary* patch for Argument Clinic that adds nullable ints.
If you use the converter "int(nullable=True), then:
* The type you get back is not int but "nullable_int_t", a structure
containing three fields: "error
Larry Hastings added the comment:
I should have mentioned--a sample using nullable ints is in itertoolsmodule.c.
longobject.{ch} changed to add the converters, and obviously clinic.py changed
to add support for the converters.
--
___
Python
Larry Hastings added the comment:
The bug you saw was an easy fix; the converter function needs to return 1
(success) from the "== Py_None" branch.
And yes, more unit tests would be good, fixing the documentation would be good
too. I did say the patch was nowhere near ready.
I w
Larry Hastings added the comment:
Then you disagree with Guido, who says that optional integer arguments without
a viable publishable default value should accept None to mean "use the default
value":
https://mail.python.org/pipermail/python-dev/2014-January/131673.html
https://mail.
Larry Hastings added the comment:
I'll fix the "return NULL" problem. However, you are using optional groups in
the list __init__. The original doesn't use them. Please stop using optional
groups in functions tha
Larry Hastings added the comment:
I guess we should ask Guido for clarification. But I got the impression that
we could *gently* tweak the signatures of functions if they were not
representable in Python syntax. He thought that giving the parameter of
_sha1.sha1() a default value of b'
Larry Hastings added the comment:
Actually, the documented behavior of itertools.repeat() is that the "times"
argument takes a default of None.
Equivalent to:
def repeat(object, times=None):
...
http://docs.python.org/3/library/itertools.html#iterto
Larry Hastings added the comment:
The fact that "def " isn't Python syntax is, if anything, a mild point in its
favor. I don't want anyone hitting on this by accident. "sig:" isn't Python
syntax either, and yet you your
Larry Hastings added the comment:
Yes, that is how it must work. This is symmetric with pure Python functions:
>>> import inspect
>>> import zlib
>>> def foo(a=zlib.Z_DEFAULT_COMPRESSION): pass
...
>>> st
Larry Hastings added the comment:
I missed the detail that you were working with a patch applied.
I suspect the problem is, you misspelled one of the expressions you provided as
a default value. Try str(inspect.signature(x)) on every function you
converted. I bet one of them will throw an
Larry Hastings added the comment:
> This is because in pure Python functions we have no enough
> information. I believe than origin expression is more useful
> in the help.
That doesn't matter. inspect.Signature would have to change in order to
provide the original expression
Larry Hastings added the comment:
- the concept of a nullable thing in Python doesn't exist; why not "optional"?
That's not what it means. Python parameters are "optional" if they
have a default value. These parameters are "nullable", in the sense
that
Larry Hastings added the comment:
This problem been independently rediscovered by people converting
code to Argument Clinic. A Python signature can't express these
semantics, where a parameter behaves differently depending on
whether it's passed in by keyword or by reference. S
Larry Hastings added the comment:
> int(or_none=True) ?
Yes, that is a different name that seems to mean much the same thing.
> Hmm, do we have a getargs.h ?
No. Would it help if I attached the output of "ls Include"
to this issue?
> > > - boolean fields can
Larry Hastings added the comment:
Fix attached. Might as well.
--
Added file: http://bugs.python.org/file33639/larry.nullable.ints.draft.3
___
Python tracker
<http://bugs.python.org/issue20
Larry Hastings added the comment:
When AC moves from internal-only tool to supported tool we'll want to convert
the xx stuff. But yeah I reckon it makes sense to not convert them yet. The
list of files is really more "here's the list of stuff to check out and convert
if ne
Larry Hastings added the comment:
> > Yes, that is a different name that seems to mean much the same
> > thing.
> and which is much more understandable by a Python developer.
Thanks for your opinion.
> > Changing error to an char and moving it to the end would
> &
New submission from Larry Hastings:
If I build current trunk on my workstation (Linux 64-bit, Ubuntu 13.10) then run
% ./python -m test -u all test_curses
I get a traceback. Here's the interesting part:
File "/home/larry/src/python/buildtrunk/Lib/test/test_curses.py"
New submission from Larry Hastings:
The signatures for builtins are stored as text and interpreted at runtime on
demand. inspect.Signature gets the default value for a parameter as a text
string, which it evaluates (by hand, in a highly constrained way) to produce
the parameter's
Larry Hastings added the comment:
I've worked your changes into the patch for #20189.
--
___
Python tracker
<http://bugs.python.org/issue20313>
___
___
Pytho
Larry Hastings added the comment:
At last, my refreshed patch. Changes from the previous patch:
* Had another mildly bright idea. The name "PyTypeObject *cls"
is a holdover from < Python 2.2 days, before the merging of classes
and types. Now they're both the same thin
Larry Hastings added the comment:
I think it's a fine name, otherwise I would not have chosen it in the first
place. Your high-spirited bikeshedding has been noted and not acted upon. I
have no plans to change the name. Please dr
Larry Hastings added the comment:
How many existing occurrences of "or_none" did you find in the CPython tree?
Perhaps we can turn our attention to other languages like SQL and C# and borrow
their term for "value that is allowed to be of a specific type (or types) as
well as
Larry Hastings added the comment:
I'm happy to resolve it before checking in the patch.
A small delta like that doesn't need a full-on review.
If people said "eww" then I'll back it out. Nobody said "eww"
to the "PyModuleDef *module" change (see b
Larry Hastings added the comment:
Drop. It.
--
___
Python tracker
<http://bugs.python.org/issue20341>
___
___
Python-bugs-list mailing list
Unsubscribe:
Larry Hastings added the comment:
I'm not sure why you're asking Nick. Is he the release manager for 3.4?
--
___
Python tracker
<http://bugs.python.o
Larry Hastings added the comment:
I don't think it's fair to call my responses "snarky". On the other hand, your
suggestion that I view Argument Clinic as "my toy project" is obviously meant
as an insult.
It is fair to call my responses "dismissive",
Larry Hastings added the comment:
My solution for pydoc was to call isroutine() instead of isfunction(), and yes
handle it throwing an exception.
(I just checked, and I wasn't catching TypeError, only ValueError. I'll fix
that in my next patch
Larry Hastings added the comment:
Is this behavior causing problems? How bad is it?
Can I get more opinions about this than just Arfrever and Antoine? Not that I
don't trust their opinions, I just want to see a larger sample size.
--
___
P
Larry Hastings added the comment:
A little more on consistency and inconsistency.
I count 109 tp_new callback functions in CPython, and they overwhelmingly call
the first parameter "PyTypeObject *type" (93 instances). In second place is
"PyObject *self" (9 instances), whi
Larry Hastings added the comment:
We had this discussion already, some months ago. The consensus was to leave it
the way it is.
--
resolution: -> rejected
status: open -> closed
___
Python tracker
<http://bugs.python.org/i
Larry Hastings added the comment:
Oops! They should be escaped.
--
___
Python tracker
<http://bugs.python.org/issue20376>
___
___
Python-bugs-list mailin
Larry Hastings added the comment:
For the record, I was actually in favor of swapping them. You can try bringing
it up again on python-dev if you like, but I'm not sure there's anything really
new to say.
--
___
Python trac
Larry Hastings added the comment:
I don't have a patch for this issue. If you're thinking of my "nullable ints"
patch, that was just an experiment. I'd prefer we figure out what we're going
to do on this issue, and we can talk abut conve
Larry Hastings added the comment:
> Note that tp_new is a static method, not a class method (the type
> creation machinery takes care of passing in the right class rather
> than the descriptor machinery)
I admit I didn't know that.
But from a practical perspective, surely you agr
Larry Hastings added the comment:
I'm sorry, but I simply don't have the time to spend to dig it up right now.
It was a while ago and I'm not sure exactly where to look.
I dimly recall it was last year, probably during September-December, and that
both Nick and I were in it.
Larry Hastings added the comment:
Your patch does not address my concern.
My concern is that itertools.repeat doesn't parse its arguments like other
Python functions. It behaves differently depending on whether "times" is
passed by position or by keyword. Therefore its
Larry Hastings added the comment:
Okay, one more diff. I have high hopes for this, but then I had high hopes
yesterday.
Nick, could you review the PyTypeObject changes in this patch? Obviously I'd
love a review of the whole thing, but if you can only make a little time, the
crucial pa
Larry Hastings added the comment:
Maybe I'm not reading this correctly. It looks like the function returns True
if it finds any .c or .h file that contains the string '[clinic input]'. It
doesn't seem to only check files that have changed.
I was considering adding a ch
Larry Hastings added the comment:
Okay, I'm checking this beast in. Hooray! Thanks for your reviews, everybody!
--
I thought it was still possible to introduce objects into Python at runtime
without calling PyType_Ready on their type. If that's true,
then there wouldn't nec
Larry Hastings added the comment:
I just realized, I forgot to fix the bug Zach reported, where help(bound_thing)
should still show the class or self parameter.
I'm going to check this in anyway, and file a fresh bug on myself to
address
New submission from Larry Hastings:
For an object O that are bound to something (either a class or an instance),
help(O) traditionally shows the bound argument. For this code:
class C:
def foo(self, a): pass
c = C()
help(c.foo) would show the signature as "(self, a)&q
Larry Hastings added the comment:
Phew! Thanks again, everybody!
--
resolution: -> fixed
stage: needs patch -> committed/rejected
status: open -> closed
___
Python tracker
<http://bugs.python.or
Larry Hastings added the comment:
The patch from #20189 has landed.
--
___
Python tracker
<http://bugs.python.org/issue17481>
___
___
Python-bugs-list mailin
Larry Hastings added the comment:
The patch from #20189 has landed.
--
___
Python tracker
<http://bugs.python.org/issue20223>
___
___
Python-bugs-list mailin
Larry Hastings added the comment:
That's because in f, y is after *args, so it is a keyword-only parameter. Its
default value is in __kwdefaults__. If you move y to before *args, its default
will be in __defaults__.
This is working as designed.
--
nosy: +larry
resol
Larry Hastings added the comment:
Okay, then yes, let's save this for 3.5. Thanks!
--
___
Python tracker
<http://bugs.python.org/issue20355>
___
___
Pytho
Larry Hastings added the comment:
I can start citing data points if you like.
socket.if_indextoname just calls PyLong_AsUnsignedLong(). Not sure what that
throws.
--
___
Python tracker
<http://bugs.python.org/issue20
Larry Hastings added the comment:
Remove the winreg.
On Jan 24, 2014 8:02 AM, Zachary Ware wrote:
>
>
> New submission from Zachary Ware:
>
> The fix for #20189 broke simple expression defaults. Specifically, with the
> latest #20172 patch applied, Clinic fails on winre
Larry Hastings added the comment:
Let's not catch Exception there. Does catching NameError make the problem go
away?
And, #20189 changed the rules for simple expressions. Now names you want from
the local module should not have the name of the module in front. You wouldn't
have
Larry Hastings added the comment:
How about I add the "if type == " checks as per #1486663?
--
___
Python tracker
<http://bugs.python.org/issue20385>
___
___
Larry Hastings added the comment:
I agree.
--
___
Python tracker
<http://bugs.python.org/issue20209>
___
___
Python-bugs-list mailing list
Unsubscribe:
Larry Hastings added the comment:
Huh. So inspect.getfullargspec is the code ignoring whether or not a function
is bound.
Well, help(x) should be consistent, whether x is a bound builtin class instance
or a bound Python class instance. Right now it isn't; it displays the "self
Larry Hastings added the comment:
I think it's a bug that they don't do the subclass check. In practice, nobody
subclasses range and itertools.tee. But they should probably still be fixed.
--
___
Python tracker
<http://bugs.python.o
Larry Hastings added the comment:
Way ahead of you. The "class" directive will have to change:
class name typedef type_object
On the other hand, this means that Argument Clinic can automatically give the
right type to the default self converter. So most people won'
Larry Hastings added the comment:
It's considered bad form to catch Exception. We should catch the minimum
necessary. If there are exceptions we forgot, people will complain and then
we'll add those.
Also, I want to make sure (if possible) that the value round-trips correctly
th
Larry Hastings added the comment:
How about this? I'm going to do a rollup patch today with three fixes: this,
#20385, and changing the default filename for the "file" destination.
--
Added file:
http://bugs.python.org/file33692/larry.clinic.rollup.ja
Larry Hastings added the comment:
How about this? I'm going to do a rollup patch today with three fixes: this,
#20381, and changing the default filename for the "file" destination.
--
Added file:
http://bugs.python.org/file33693/larry.clinic.rollup.ja
Larry Hastings added the comment:
There's a major difference between getfullargspec/getargspec and
inspect.signature: getfullargspec shows you the "self" parameter for bound
methods, and inspect.signature does not.
>>> class C:
...def foo(self, a): pass
...
&g
Changes by Larry Hastings :
--
title: help(bound_builtin_class) does not display self ->
help(instance_of_builtin_class.method) does not display self
___
Python tracker
<http://bugs.python.org/issu
Larry Hastings added the comment:
Yeah, that's a good approach.
By the way, I'm definitely going to check for "unspecified" there. Serhiy was
using that to try and trick Argument Clinic into having optional parameters
without default values. It didn't actually
Larry Hastings added the comment:
Yup! Second time I've done that this week!
--
___
Python tracker
<http://bugs.python.org/issue20379>
___
___
Python-bugs-l
Larry Hastings added the comment:
Yeah, that's a good approach.
--
___
Python tracker
<http://bugs.python.org/issue20381>
___
___
Python-bugs-list m
Larry Hastings added the comment:
Right. So my advice is: only use local symbols and symbols in preloaded
modules.
--
___
Python tracker
<http://bugs.python.org/issue20
Larry Hastings added the comment:
1) That's not a bug, that's the API. If you used the dynamic API to create a
type it wouldn't take the &. So I can't guess in advance what type it is, nor
can I assume I always
Larry Hastings added the comment:
If you use a self converter you can name your first parameter anything you like.
--
___
Python tracker
<http://bugs.python.org/issue20
Larry Hastings added the comment:
So, are you still claiming there's a bug here? Or can we close this?
--
___
Python tracker
<http://bugs.python.org/is
Larry Hastings added the comment:
The logic of the patch is hard to follow. However, it's still examining the
size of args, and now it's examining the size of kwargs, and behaving
differently based on these sizes is exactly what I don't want.
I've attached an example
Larry Hastings added the comment:
You should only put one line of equals signs? I'll try to remember that in the
future. LGTM. Shall I commit it?
--
___
Python tracker
<http://bugs.python.org/is
Larry Hastings added the comment:
If two issues are created on the tracker for the same issue, surely it's the
*older* issue that is preserved, and the new one marked as duplicate and closed?
--
___
Python tracker
<http://bugs.python.org/is
Changes by Larry Hastings :
--
resolution: -> invalid
stage: -> committed/rejected
status: open -> closed
___
Python tracker
<http://bugs.python.or
Larry Hastings added the comment:
I think you've understood it.
The problem is, in order to deprecate the behavior, we first must provide the
new behavior. (That's official policy, in PEP 5.) It's untenable to say
"you'll have to stop using 'times=-1
Larry Hastings added the comment:
You didn't give me a test case, and I can't reproduce this. Either it was
accidentally fixed already, or there's something else going on in your test
case.
I'm closing this for now as unreproducable. If you see the problem again,
plea
New submission from Larry Hastings:
Rollup patch with a bunch of small fixes in it. Can I get a quick turnaround
review on this? I'd like it to go in before today's beta is cut. Definitely
the core change has to go in, but that's uncontroversial.
Core:
* _PyType_GetDoc
Larry Hastings added the comment:
The bug you cited is fixed in today's rollup patch, #20390. (I don't know how
to denote the dependency between the two issues, maybe someone else can do that
for me?)
--
___
Python tracker
<http://bu
Larry Hastings added the comment:
The bug you cited is fixed in today's rollup patch, #20390. (I don't know how
to denote the dependency between the two issues, maybe someone else can do that
for me?)
--
___
Python tracker
<http://bu
Larry Hastings added the comment:
You didn't supply a test case, nor is there any code checked in that reproduced
the issue. I had to make a test case by hand.
--
___
Python tracker
<http://bugs.python.org/is
Larry Hastings added the comment:
Thanks for the reviews, Nick and Serhiy, especially considering that the
Rietveld link didn't work!
Serhiy: I believe I fixed everything. There are no side files checked in yet.
Can you give me another review?
--
Added file:
http://bugs.pytho
Changes by Larry Hastings :
Removed file:
http://bugs.python.org/file33710/larry.clinic.rollup.jan.25.diff.2.txt
___
Python tracker
<http://bugs.python.org/issue20
Larry Hastings added the comment:
Hang on, my tree was out of date. Which is why I didn't get a review link,
duh. And if side files have appeared I'll fix 'em.
--
___
Python tracker
<http://bugs.pyt
Larry Hastings added the comment:
Okay, here's my revised patch, for real this time, with "hg mv" for the side
files and everything.
--
Added file:
http://bugs.python.org/file33711/larry.clinic.rollup.jan.25.diff.2.txt
___
Python
Larry Hastings added the comment:
Can you try locally applying my patch for #20390 and seeing if you still have
the problem? I tried applying it to the itertoolmodule.c you attached to the
issue and it seemed to fix the problem.
--
___
Python
1401 - 1500 of 2415 matches
Mail list logo