This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: types module can be implemented only in Python
Type: enhancement Stage:
Components: Interpreter Core, Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, benjamin.peterson, christian.heimes
Priority: normal Keywords: patch

Created on 2008-03-18 21:09 by benjamin.peterson, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
expose_cell.patch benjamin.peterson, 2008-03-18 21:09 exposes cell objects
expose_cell_python.patch benjamin.peterson, 2008-03-18 22:30 better implementation
types_in_python.diff benjamin.peterson, 2008-03-18 22:43 makes the types module use python only
Messages (7)
msg63988 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-03-18 21:09
types currently exposes all types used by the interpreter except cell
objects. This patch adds support for that and adds to the docs. I
couldn't find a way to access the cell type through Python, so I added
it to the _types module.
msg64001 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-03-18 22:23
The following python code retrieves the cell type, and could be added to
types.py:

def _f(x=None):
   def g():
      x
   return g

CellType = type(_f().func_closure[0])

OTOH, you are unlikely to need it. Do you have a use case, or is it just
to have the full list of types?
msg64003 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-03-18 22:29
While I'm at it, the _types module could be removed, because its exports
can easily be replaced by:

GetSetDescriptorType = type(Exception.args)
MemberDescriptorType = type(EnvironmentError.errno)
msg64004 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-03-18 22:30
I've attached a patch which uses the Amaury's implementation.

>OTOH, you are unlikely to need it. Do you have a use case, or is it just
>to have the full list of types?
Mostly, I want a full list of types.
msg64007 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-03-18 22:43
Okay, I removed the _types module in favor of your Python
implementation. Here's the patch.
msg64252 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2008-03-21 18:29
Please have a look at patch #1605, too. It implements a semi
autogenerated _types module which exposes all types in from Include/*.h
msg65221 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-04-08 22:09
Committed r62231: remove _types module.

I did not add CellType though, because of discussion in #1605.
History
Date User Action Args
2022-04-11 14:56:32adminsetgithub: 46660
2008-04-08 22:09:42amaury.forgeotdarcsetstatus: open -> closed
resolution: accepted
messages: + msg65221
2008-03-21 18:29:51christian.heimessetnosy: + christian.heimes
messages: + msg64252
2008-03-18 22:43:18benjamin.petersonsetfiles: + types_in_python.diff
messages: + msg64007
title: types should expose cell object -> types module can be implemented only in Python
2008-03-18 22:30:22benjamin.petersonsetfiles: + expose_cell_python.patch
messages: + msg64004
2008-03-18 22:29:40amaury.forgeotdarcsetmessages: + msg64003
2008-03-18 22:23:49amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg64001
2008-03-18 21:09:29benjamin.petersoncreate