[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-03-31 Thread Donald Stufft

Changes by Donald Stufft :


--
pull_requests: +1045

___
Python tracker 

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



[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-03-31 Thread Jim Fasarakis-Hilliard

Changes by Jim Fasarakis-Hilliard :


--
pull_requests: +823

___
Python tracker 

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



[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


___
Python tracker 

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



[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


___
Python tracker 

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



[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-02-01 Thread Roundup Robot

Roundup Robot added the comment:


New changeset 1947d33a0a1c2ba006397579ec6235528faea9fd by Guido van Rossum in 
branch 'master':
Issue #29377: Add three new wrappers to types.py (Manuel Krebber).
https://github.com/python/cpython/commit/1947d33a0a1c2ba006397579ec6235528faea9fd


--

___
Python tracker 

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



[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-02-01 Thread Roundup Robot

Changes by Roundup Robot :


--
stage:  -> resolved

___
Python tracker 

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



[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-02-01 Thread Guido van Rossum

Guido van Rossum added the comment:

Thanks Manuel and Ivan!

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-02-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3db1959c2c53 by Guido van Rossum in branch 'default':
Issue #29377: Add three new wrappers to types.py (Manuel Krebber).
https://hg.python.org/cpython/rev/3db1959c2c53

--
nosy: +python-dev

___
Python tracker 

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



[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-02-01 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

Guido, I attach the full patch now, as you asked.

(Initially I was not sure about tests, but now I understand more these types, 
so that I added even few more tests than in original patch)

> Maybe we need to wait for the github migration to complete though?

I think it is OK to merge this now, but if it would be easier for you then it 
is not a problem to wait until GH migration is complete.

Manuel, I think that probably the answer is yes, but I would prefer a separate 
issue for the inspect module. You could open a new issue and mention this one 
as a dependency.

--
Added file: http://bugs.python.org/file46477/combined-patch-full-total.diff

___
Python tracker 

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



[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-02-01 Thread Manuel Krebber

Manuel Krebber added the comment:

One question I was wondering about is whether those types should be checked by 
inspect.isroutine() as well.

--

___
Python tracker 

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



[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-01-31 Thread Guido van Rossum

Guido van Rossum added the comment:

Seems the combined patch doesn't include the tests. Nor does the most recent 
slot-wrappre-types.patch.

Ivan, can you make a single truly combined patch and add a Misc/NEWS entry to 
it as well?

Other than that this looks fine.

Maybe we need to wait for the github migration to complete though?

--

___
Python tracker 

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



[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-01-30 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

Thank you!
The new patch LGTM.
(I combined two diffs in your patch into one so that it could be understood by 
Rietveld).

Guido, Yury, could one of you please take a look at this?

--
nosy: +yselivanov
Added file: http://bugs.python.org/file46457/combined-patch.diff

___
Python tracker 

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



[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-01-30 Thread Manuel Krebber

Manuel Krebber added the comment:

Okay, I added MethodDescriptorType to the types module and updated the docs. 
Hope this is okay now.

--
Added file: http://bugs.python.org/file46455/slot-wrapper-types.patch

___
Python tracker 

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



[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-01-27 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

Manuel, thank you for the new patch now everything works. I have few more 
comments:
1. I have found that there is one more built-in type: type(str.join) gives 
. Maybe it makes sense to add this one too?
2. Taking into account previous point I withdraw my idea of needing tests here. 
Sorry for changing opinion twice, but it looks like there are many built-in 
types that seem to exist just for historical reasons. They might change in 
future.
3. Please take a look at my review on documentation in Rietveld.

--

___
Python tracker 

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



[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-01-27 Thread Manuel Krebber

Manuel Krebber added the comment:

I created the last patch without commiting, so maybe this one will work 
properly with the revision tool.

--
Added file: http://bugs.python.org/file46429/slot-wrapper-types.patch

___
Python tracker 

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



[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-01-26 Thread Manuel Krebber

Manuel Krebber added the comment:

Alright, I added some tests and tried it again with the patch.

--
Added file: http://bugs.python.org/file46427/slot-wrapper-types.patch

___
Python tracker 

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



[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-01-26 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

> but an isinstance test seems pretty redundant.

Tests are never redundant :-) Just add one-two asserts that you think should be 
true about issubclass and isinstance with these types (like 
self.assertIsInstance(''.__add__, types.MethodWrapperType)). String 
representation on the contrary is less important.

For some reason your patch is still not recognized by review tool. But don't 
worry about this, if it will not work, I will try to fix it.

--

___
Python tracker 

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



[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-01-26 Thread Manuel Krebber

Manuel Krebber added the comment:

I added some docs, but I am not sure what I would want to test here. There are 
no tests for types.BuiltinMethodType either. Maybe the string representation of 
it could be tested, but an isinstance test seems pretty redundant. I hope this 
patch file works better, I created the last one with git diff.

--
Added file: http://bugs.python.org/file46425/slot-wrapper-types.patch

___
Python tracker 

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



[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-01-26 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

Manuel, thank you for a patch!

Two comments:
1. Please produce your patch using Mercurial ``hg diff`` command, so that it 
could be recognized by review tool and merged easily.
2. Your patch should also include few tests (Lib/test/test_types.py) and 
documentation (Doc/library/types.rst)

--

___
Python tracker 

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



[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-01-26 Thread Manuel Krebber

Manuel Krebber added the comment:

I would suggest the names SlotWrapperType and MethodWrapperType because I think 
they match their string representations the closest.

For checking whether something is a method/function one could also use 
inspect.isroutine (or inspect.ismethoddescriptor), but that is inconsistent 
with regards to builtin and python methods:

>>> import inspect
>>> inspect.isroutine(object.__init__)
True
>>> inspect.isroutine(object().__init__)
False
>>> class A:
...   def f(self):
... pass
...
>>> inspect.isroutine(A.f)
True
>>> inspect.isroutine(A().f)
True

Maybe a function to detect the second case is needed.

--

___
Python tracker 

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



[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-01-26 Thread Manuel Krebber

Changes by Manuel Krebber :


--
keywords: +patch
Added file: 
http://bugs.python.org/file46420/0001-Added-SlotWrapperType-and-MethodWrapperType-to-the-t.patch

___
Python tracker 

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



[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-01-26 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

Manuel, it would be helpful if you submit a patch.

Guido, this is necessary for ``get_type_hints`` to work nicer with built-in 
methods, see https://github.com/python/typing/pull/368

--
nosy: +gvanrossum, levkivskyi
versions: +Python 3.7

___
Python tracker 

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



[issue29377] Add the 'wrapper_descriptor' type to the types module

2017-01-26 Thread Manuel Krebber

New submission from Manuel Krebber:

There currently is no type in the types module for the slot 
wrappers/wrapper_descriptor types.

I would like to have something like

WrapperDescriptor = type(object.__init__)

added to it (or maybe even add it to MethodType). This would be helpful to 
check more easily if some object is a method.

I can create a pull request for this if desired.

--
components: Library (Lib)
messages: 286304
nosy: Wheerd
priority: normal
severity: normal
status: open
title: Add the 'wrapper_descriptor' type to the types module
type: enhancement

___
Python tracker 

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