[Python-checkins] python/nondist/peps pep-0307.txt,1.10,1.11

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Tue, 04 Feb 2003 11:28:19 -0800


Update of /cvsroot/python/python/nondist/peps
In directory sc8-pr-cvs1:/tmp/cvs-serv639

Modified Files:
	pep-0307.txt 
Log Message:
Document the extension registry API.

Remove mention of Twisted (they don't want it).


Index: pep-0307.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0307.txt,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** pep-0307.txt	4 Feb 2003 19:12:25 -0000	1.10
--- pep-0307.txt	4 Feb 2003 19:28:16 -0000	1.11
***************
*** 534,540 ****
      between extension codes and names.
  
!     Second, some large Python projects (e.g. Zope or Twisted) can be
!     assigned a range of extension codes outside the "private use"
!     range that they can assign as they see fit.
  
      The extension registry is defined as a mapping between extension
--- 534,540 ----
      between extension codes and names.
  
!     Second, some large Python projects (e.g. Zope) can be assigned a
!     range of extension codes outside the "private use" range that they
!     can assign as they see fit.
  
      The extension registry is defined as a mapping between extension
***************
*** 557,566 ****
          192   239    48  Reserved for 3rd parties
          240   255    16  Reserved for private use (will never be assigned)
!         256   Max   Max  Reserved for future assignment
  
!     'Max' stands for 2147483647, or 2**31-1.  This is a hard
!     limitation of the protocol as currently defined.
  
      At the moment, no specific extension codes have been assigned yet.
  
  
--- 557,597 ----
          192   239    48  Reserved for 3rd parties
          240   255    16  Reserved for private use (will never be assigned)
!         256   MAX   MAX  Reserved for future assignment
  
!     MAX stands for 2147483647, or 2**31-1.  This is a hard limitation
!     of the protocol as currently defined.
  
      At the moment, no specific extension codes have been assigned yet.
+ 
+ 
+ Extension registry API
+ 
+     The extension registry is maintained as private global variables
+     in the copy_reg module.  The following three functions are defined
+     in this module to manipulate the registry:
+ 
+     add_extension(module, name, code)
+         Register an extension code.  The module and name arguments
+         must be strings; code must be an int in the inclusive range 1
+         through MAX.  This must either register a new (module, name)
+         pair to a new code, or be a redundant repeat of a previous
+         call that was not canceled by a remove_extension() call; a
+         (module, name) pair may not be mapped to more than one code,
+         nor may a code be mapped to more than one (module, name)
+         pair.  (XXX Aliasing may actually cause as problem for this
+         requirement; we'll see as we go.)
+ 
+     remove_extension(module, name, code)
+         Arguments are as for add_extension().  Remove a previously
+         registered mapping between (module, name) and code.
+ 
+     clear_extension_cache()
+         The implementation of extension codes may use a cache to speed
+         up loading objects that are named frequently.  This cache can
+         be emptied (removing references to cached objects) by calling
+         this method.
+ 
+     Note that the API does not enforce the standard range assignments.
+     It is up to applications to respect these.