Tim Peters | 6d6c1a3 | 2001-08-02 04:15:00 +0000 | [diff] [blame] | 1 | Project: core implementation |
| 2 | **************************** |
| 3 | |
| 4 | Tasks: |
| 5 | |
| 6 | Do binary operators properly. nb_add should try to call self.__add__ |
| 7 | and other.__radd__. I think I'll exclude base types that define any |
Guido van Rossum | 396c032 | 2001-08-08 22:51:13 +0000 | [diff] [blame] | 8 | binary operator without setting the CHECKTYPES flag. *** This is |
| 9 | done, AFAICT. Even supports __truediv__ and __floordiv__. *** |
Tim Peters | 6d6c1a3 | 2001-08-02 04:15:00 +0000 | [diff] [blame] | 10 | |
| 11 | Fix comparisons. There's some nasty stuff here: when two types are |
| 12 | not the same, and they're not instances, the fallback code doesn't |
| 13 | account for the possibility that they might be subtypes of a common |
| 14 | base type that defines a comparison. |
| 15 | |
| 16 | Fix subtype_dealloc(). This currently searches through the list of |
| 17 | base types until it finds a type whose tp_dealloc is not |
| 18 | subtype_dealloc. I think this is not safe. I think the alloc/dealloc |
| 19 | policy needs to be rethought. *** There's an idea here that I haven't |
| 20 | worked out yet: just as object creation now has separate API's tp_new, |
| 21 | tp_alloc, and tp_init, destruction has tp_dealloc and tp_free. (Maybe |
| 22 | tp_fini should be added to correspond to tp_init?) Something |
| 23 | could/should be done with this. *** |
| 24 | |
| 25 | Clean up isinstance(), issubclass() and their C equivalents. There |
| 26 | are a bunch of different APIs here and not all of them do the right |
| 27 | thing yet. There should be fewer APIs and their implementation should |
| 28 | be simpler. The old "abstract subclass" test should probably |
| 29 | disappear (if we want to root out ExtensionClass). *** I think I've |
| 30 | done 90% of this by creating PyType_IsSubtype() and using it |
| 31 | appropriately. For now, the old "abstract subclass" test is still |
| 32 | there, and there may be some places where PyObject_IsSubclass() is |
| 33 | called where PyType_IsSubtype() would be more appropriate. *** |
| 34 | |
| 35 | Check for conflicts between base classes. I fear that the rules used |
| 36 | to decide whether multiple bases have conflicting instance variables |
| 37 | aren't strict enough. I think that sometimes two different classes |
| 38 | adding __dict__ may be incompatible after all. |
| 39 | |
| 40 | Check for order conflicts. Suppose there are two base classes X and |
| 41 | Y. Suppose class B derives from X and Y, and class C from Y and X (in |
| 42 | that order). Now suppose class D derives from B and C. In which |
| 43 | order should the base classes X and Y be searched? This is an order |
| 44 | conflict, and should be disallowed; currently the test for this is not |
| 45 | implemented. |
| 46 | |
| 47 | Clean up the GC interface. Currently, tp_basicsize includes the GC |
| 48 | head size iff tp_flags includes the GC flag bit. This makes object |
| 49 | size math a pain (e.g. to see if two object types have the same |
| 50 | instance size, you can't just compare the tp_basicsize fields -- you |
| 51 | have to conditionally subtract the GC head size). Neil has a patch |
| 52 | that improves the API in this area, but it's backwards incompatible. |
| 53 | (http://sf.net/tracker/?func=detail&aid=421893&group_id=5470&atid=305470) |
| 54 | I think I know of a way to fix the incompatibility (by switching to a |
| 55 | different flag bit). *** Tim proposed a better idea: macros to access |
| 56 | tp_basicsize while hiding the nastiness. This is done now, so I think |
| 57 | the rest of this task needn't be done. *** |
| 58 | |
| 59 | Make the __dict__ of types declared with Python class statements |
| 60 | writable -- only statically declared types must have an immutable |
| 61 | dict, because they're shared between interpreter instances. Possibly |
| 62 | trap writes to the __dict__ to update the corresponding tp_<slot> if |
| 63 | an __<slot>__ name is affected. *** Done as part of the next task. *** |
| 64 | |
| 65 | It should be an option (maybe a different metaclass, maybe a flag) to |
| 66 | *not* merge __dict__ with all the bases, but instead search the |
| 67 | __dict__ (or __introduced__?) of all bases in __mro__ order. (This is |
| 68 | needed anyway to unify classes completely.) *** Partly done. |
| 69 | Inheritance of slots from bases is still icky: (1) MRO is not always |
| 70 | respected when inheriting slots; (2) dynamic classes can't add slot |
| 71 | implementations in Python after creation (e.g., setting C.__hash__ |
| 72 | doesn't set the tp_hash slot). *** |
| 73 | |
| 74 | Universal base class (object). How can we make the object class |
| 75 | subclassable and define simple default methods for everything without |
| 76 | having these inherited by built-in types that don't want these |
| 77 | defaults? *** Done, really. *** |
| 78 | |
| 79 | Add error checking to the MRO calculation. *** Done. *** |
| 80 | |
| 81 | Make __new__ overridable through a Python class method (!). Make more |
| 82 | of the sub-algorithms of type construction available as methods. *** |
| 83 | After I implemented class methods, I found that in order to be able |
| 84 | to make an upcall to Base.__new__() and have it create an instance of |
| 85 | your class (rather than a Base instance), you can't use class methods |
| 86 | -- you must use static methods. So I've implemented those too. I've |
| 87 | hooked up __new__ in the right places, so the first part of this is |
| 88 | now done. I've also exported the MRO calculation and made it |
| 89 | overridable, as metamethod mro(). I believe that closes this topic |
| 90 | for now. I expect that some warts will only be really debugged when |
| 91 | we try to use this for some, eh, interesting types such as tuples. *** |
| 92 | |
Guido van Rossum | 0415620 | 2001-08-08 16:57:43 +0000 | [diff] [blame] | 93 | There was a sequel to the __new__ story (see checkins). There |
| 94 | still is a problem: object.__new__ now no longer exists, because |
| 95 | it was inherited by certain extension types that could break. But |
| 96 | now when I write |
| 97 | |
| 98 | class C(object): |
| 99 | def __new__(cls, *args): |
| 100 | "How do I call the default __new__ implementation???" |
| 101 | |
Guido van Rossum | 42a8c2b | 2001-08-09 20:25:58 +0000 | [diff] [blame] | 102 | This was resolved nicely by putting object.__new__ back but not |
| 103 | inheriting __new__ from object when the subtype is a built-in or |
| 104 | extension type. |
| 105 | |
Tim Peters | 6d6c1a3 | 2001-08-02 04:15:00 +0000 | [diff] [blame] | 106 | More -- I'm sure new issues will crop up as we go. |
| 107 | |
| 108 | |
| 109 | Project: loose ends and follow-through |
| 110 | ************************************** |
| 111 | |
| 112 | Tasks: |
| 113 | |
| 114 | Make more (most?) built-in types act as their own factory functions. |
| 115 | |
| 116 | Make more (most?) built-in types subtypable -- with or without |
| 117 | overridable allocation. *** This includes descriptors! It should be |
| 118 | possible to write descriptors in Python, so metaclasses can do clever |
| 119 | things with them. *** |
| 120 | |
| 121 | Exceptions should be types. This changes the rules, since now almost |
| 122 | anything can be raised (as maybe it should). Or should we strive for |
| 123 | enforcement of the convention that all exceptions should be derived |
| 124 | from Exception? String exceptions will be another hassle, to be |
| 125 | deprecated and eventually ruled out. |
| 126 | |
| 127 | Standardize a module containing names for all built-in types, and |
| 128 | standardize on names. E.g. should the official name of the string |
| 129 | type be 'str', 'string', or 'StringType'? |
| 130 | |
| 131 | Create a hierarchy of types, so that e.g. int and long are both |
| 132 | subtypes of an abstract base type integer, which is itself a subtype |
| 133 | of number, etc. A lot of thinking can go into this! |
| 134 | |
| 135 | *** NEW TASK??? *** |
| 136 | Implement "signature" objects. These are alluded to in PEP 252 but |
| 137 | not yet specified. Supposedly they provide an easily usable API to |
| 138 | find out about function/method arguments. Building these for Python |
| 139 | functions is simple. Building these for built-in functions will |
| 140 | require a change to the PyMethodDef structure, so that a type can |
| 141 | provide signature information for its C methods. (This would also |
| 142 | help in supporting keyword arguments for C methods with less work than |
| 143 | PyArg_ParseTupleAndKeywords() currently requires.) But should we do |
| 144 | this? It's additional work and not required for any of the other |
| 145 | parts. |
| 146 | |
| 147 | |
| 148 | Project: making classes use the new machinery |
| 149 | ********************************************* |
| 150 | |
| 151 | Tasks: |
| 152 | |
| 153 | Try to get rid of all code in classobject.c by deferring to the new |
| 154 | mechanisms. How far can we get without breaking backwards |
| 155 | compatibility? This is underspecified because I haven't thought much |
| 156 | about it yet. Can we lose the use of PyInstance_Check() everywhere? |
| 157 | I would hope so! |
| 158 | |
| 159 | |
| 160 | Project: backwards compatibility |
| 161 | ******************************** |
| 162 | |
| 163 | Tasks: |
| 164 | |
| 165 | Make sure all code checks the proper tp_flags bit before accessing |
| 166 | type object fields. |
| 167 | |
| 168 | Identify areas of incompatibility with Python 2.1. Design solutions. |
| 169 | Implement and test. |
| 170 | |
| 171 | Some specific areas: a fair amount of code probably depends on |
| 172 | specific types having __members__ and/or __methods__ attributes. |
| 173 | These are currently not present (conformant to PEP 252, which proposes |
| 174 | to drop them) but we may have to add them back. This can be done in a |
| 175 | generic way with not too much effort. Tim adds: Perhaps that dir(object) |
| 176 | rarely returns anything but [] now is a consequence of this. I'm very |
| 177 | used to doing, e.g., dir([]) or dir("") in an interactive shell to jog my |
| 178 | memory; also one of the reasons test_generators failed. |
| 179 | |
| 180 | Another area: going all the way with classes and instances means that |
| 181 | type(x) == types.InstanceType won't work any more to detect instances. |
| 182 | Should there be a mode where this still works? Maybe this should be |
| 183 | the default mode, with a warning, and an explicit way to get the new |
| 184 | way to work? (Instead of a __future__ statement, I'm thinking of a |
| 185 | module global __metaclass__ which would provide the default metaclass |
| 186 | for baseless class statements.) |
| 187 | |
| 188 | |
| 189 | Project: testing |
| 190 | **************** |
| 191 | |
| 192 | Tasks: |
| 193 | |
| 194 | Identify new functionality that needs testing. Conceive unit tests |
| 195 | for all new functionality. Conceive stress tests for critical |
| 196 | features. Run the tests. Fix bugs. Repeat until satisfied. |
| 197 | |
| 198 | Note: this may interact with the branch integration task. |
| 199 | |
| 200 | |
Tim Peters | f980301 | 2001-08-02 22:06:35 +0000 | [diff] [blame] | 201 | Project: integration with main branch *** This is done - tim *** |
Tim Peters | 6d6c1a3 | 2001-08-02 04:15:00 +0000 | [diff] [blame] | 202 | ************************************* |
| 203 | |
| 204 | Tasks: |
| 205 | |
| 206 | Merge changes in the HEAD branch into the descr-branch. Then merge |
| 207 | the descr-branch back into the HEAD branch. |
| 208 | |
| 209 | The longer we wait, the more effort this will be -- the descr-branch |
| 210 | forked off quite a long time ago, and there are changes everywhere in |
| 211 | the HEAD branch (e.g. the dict object has been radically rewritten). |
| 212 | |
| 213 | On the other hand, if we do this too early, we'll have to do it again |
| 214 | later. |
| 215 | |
| 216 | Note from Tim: We should never again wait until literally 100s of files |
| 217 | are out of synch. I don't care how often I need to do this, provided only |
| 218 | that it's a tractable task each time. Once per week sounds like a good |
| 219 | idea. As is, even the trunk change to rangeobject.c created more than its |
| 220 | proper share of merge headaches, because it confused all the other reasons |
| 221 | include file merges were getting conflicts (the more changes there are, the |
| 222 | worse diff does; indeed, I came up with the ndiff algorithm in the 80s |
| 223 | precisely because the source-control diff program Cray used at the time |
| 224 | produced minimal but *senseless* diffs, thus creating artificial conflicts; |
| 225 | paying unbounded attention to context does a much better job of putting |
| 226 | changes where they make semantic sense too; but we're stuck with Unix diff |
| 227 | here, and it isn't robust in this sense; if we don't keep its job simple, |
| 228 | it will make my job hell). |
| 229 | |
| 230 | Done: |
| 231 | To undo or rename before final merge: Modules/spam.c has worked its |
| 232 | way into the branch Unix and Windows builds (pythoncore.dsp and |
| 233 | PC/config.c); also imported by test_descr.py. How about renaming to |
Tim Peters | f980301 | 2001-08-02 22:06:35 +0000 | [diff] [blame] | 234 | xxsubtype.c (whatever) now? *** this is done - tim *** |
Tim Peters | 6d6c1a3 | 2001-08-02 04:15:00 +0000 | [diff] [blame] | 235 | |
| 236 | |
| 237 | Project: performance tuning |
| 238 | *************************** |
| 239 | |
| 240 | Tasks: |
| 241 | |
| 242 | Pick or create a general performance benchmark for Python. Benchmark |
| 243 | the new system vs. the old system. Profile the new system. Improve |
| 244 | hotspots. Repeat until satisfied. |
| 245 | |
| 246 | Note: this may interact with the branch integration task. |
| 247 | |
| 248 | |
| 249 | Project: documentation |
| 250 | ********************** |
| 251 | |
| 252 | Tasks: |
| 253 | |
| 254 | Update PEP 252 (descriptors). Describe more of the prototype |
| 255 | implementation |
| 256 | |
| 257 | Update PEP 253 (subtyping). Complicated architectural wrangling with |
| 258 | metaclasses. There is an interaction between implementation and |
| 259 | description. |
| 260 | |
| 261 | Write PEP 254 (unification of classes). This should discuss what |
| 262 | changes for ordinary classes, and how we can make it more b/w |
| 263 | compatible. |
| 264 | |
| 265 | Other documentation. There needs to be user documentation, |
| 266 | eventually. |
| 267 | |
| 268 | |
| 269 | Project: community interaction |
| 270 | ****************************** |
| 271 | |
| 272 | Tasks: |
| 273 | |
| 274 | Once the PEPs are written, solicit community feedback, and formulate |
| 275 | responses to the feedback. Give the community enough time to think |
| 276 | over this complicated proposal. Provide the community with a |
| 277 | prototype implementation to test. Try to do this *before* casting |
| 278 | everything in stone! |
| 279 | |
| 280 | MERGE BEGIN **************************************************************** |
| 281 | Merge details (this section is Tim's scratchpad, but should help a lot if |
| 282 | he dies of frustration while wrestling with CVS <0.9 wink>). |
| 283 | ---------------------------------------------------------------------------- |
| 284 | 2001-08-01 Merging descr-branch back into trunk. |
| 285 | |
| 286 | Tagged trunk about 22:05: |
| 287 | cvs tag date2001-08-01 python |
| 288 | |
| 289 | Merged trunk delta into branch: |
| 290 | cvs -q -z3 up -j date2001-07-30 -j date2001-08-01 descr |
| 291 | |
| 292 | No conflicts (! first time ever!) ... but problems with pythoncore.dsp. |
| 293 | Resolved. |
| 294 | |
| 295 | Rebuilt from scratch; ran all tests; checked into branch about 22:40. |
| 296 | |
Tim Peters | f980301 | 2001-08-02 22:06:35 +0000 | [diff] [blame] | 297 | Merged descr-branch back into trunk (SEE BELOW -- this specific way of |
| 298 | doing it was a bad idea): |
| 299 | |
Tim Peters | 6d6c1a3 | 2001-08-02 04:15:00 +0000 | [diff] [blame] | 300 | cvs -q -z3 up -j descr-branch python |
| 301 | |
| 302 | 34 conflicts. Hmm! OK, looks like every file in the project with an |
| 303 | embedded RCS Id is "a conflict". Others make no sense, e.g., a dozen |
| 304 | conflicts in dictobject.c, sometimes enclosing identical(!) blobs of |
| 305 | source code. And CVS remains utterly baffled by Python type object decls. |
Tim Peters | f980301 | 2001-08-02 22:06:35 +0000 | [diff] [blame] | 306 | Every line of ceval.c's generator code is in conflict blocks ... OK, |
Tim Peters | 6d6c1a3 | 2001-08-02 04:15:00 +0000 | [diff] [blame] | 307 | there's no pattern or sense here, I'll just deal with it. |
| 308 | |
Tim Peters | f980301 | 2001-08-02 22:06:35 +0000 | [diff] [blame] | 309 | Conflicts resolved; rebuilt from scratch; test_weakref fails. Didn't find |
| 310 | an obvious reason and it was late, so committed it anyway. Tagged the |
| 311 | trunk then with tag: |
| 312 | |
| 313 | after-descr-branch-merge |
| 314 | |
| 315 | Tracked the test_weakref failure to a botched conflict resolution in |
| 316 | classobject.c; checked in a fix. |
| 317 | |
| 318 | LATER: The merge should have been done via: |
| 319 | |
| 320 | upd -j date2001-08-01 -j descr-branch python |
| 321 | |
| 322 | instead. This would have caused only one conflict, a baffler in |
| 323 | bltinmodule.c. It would have avoided the classobject.c error I made. |
| 324 | Luckily, except for that one, we got to the same place in the end anyway, |
| 325 | apart from a few curious tabs-vs-spaces differences. |
Tim Peters | 6d6c1a3 | 2001-08-02 04:15:00 +0000 | [diff] [blame] | 326 | ---------------------------------------------------------------------------- |
| 327 | 2001-07-30 |
| 328 | |
| 329 | Doing this again while the expat and Windows installer changes are still |
| 330 | fresh on my mind. |
| 331 | |
| 332 | Tagged trunk about 23:50 EDT on the 29th: |
| 333 | cvs tag date2001-07-30 python |
| 334 | |
| 335 | Merged trunk delta into branch: |
| 336 | |
| 337 | cvs -q -z3 up -j date2001-07-28 -j date2001-07-30 descr |
| 338 | |
| 339 | 2 conflicts, resolved. |
| 340 | ---------------------------------------------------------------------------- |
| 341 | 2001-07-28 |
| 342 | |
| 343 | Tagged trunk about 00:31 EDT: |
| 344 | cvs tag date2001-07-28 python |
| 345 | |
| 346 | Merged trunk delta into branch: |
| 347 | cvs -q -z3 up -j date2001-07-21 -j date2001-07-28 descr |
| 348 | |
| 349 | 4 conflicts, all RCS Ids. Resolved. |
| 350 | ---------------------------------------------------------------------------- |
| 351 | 2001-07-21 |
| 352 | |
| 353 | Tagged trunk about 01:00 EDT: |
| 354 | cvs tag date2001-07-21 python |
| 355 | |
| 356 | Merged trunk delta into branch: |
| 357 | cvs -q -z3 up -j date2001-07-17b -j date2001-07-21 descr |
| 358 | |
| 359 | 4 conflicts, mostly RCS Id thingies. Resolved. |
| 360 | |
| 361 | Legit failure in new test_repr, because repr.py dispatches on the exact |
| 362 | string returned by type(x). type(1L) and type('s') differ in descr-branch |
| 363 | now, and repr.py didn't realize that, falling back to the "unknown type" |
| 364 | case for longs and strings. Repaired descr-branch repr.py. |
| 365 | ---------------------------------------------------------------------------- |
| 366 | 2001-07-19 |
| 367 | |
| 368 | Removed the r22a1-branch tag (see next entry). Turns out Guido did add a |
| 369 | r22a1 tag, so the r22a1-branch tag served no point anymore. |
| 370 | ---------------------------------------------------------------------------- |
| 371 | 2001-07-18 2.2a1 releaase |
| 372 | |
| 373 | Immediately after the merge just below, I tagged descr-branch via |
| 374 | |
| 375 | cvs tag r22a1-branch descr |
| 376 | |
| 377 | Guido may or may not want to add another tag here (? maybe he wants to do |
| 378 | some more Unix fiddling first). |
| 379 | ---------------------------------------------------------------------------- |
| 380 | 2001-07-17 building 2.2a1 release, from descr-branch |
| 381 | |
| 382 | Tagged trunk about 22:00 EDT, like so: |
| 383 | cvs tag date2001-07-17b python |
| 384 | |
| 385 | Merged trunk delta into branch via: |
| 386 | cvs -q -z3 up -j date2001-07-17a -j date2001-07-17b descr |
| 387 | ---------------------------------------------------------------------------- |
| 388 | 2001-07-17 |
| 389 | |
| 390 | Tagged trunk about 00:05 EDT, like so: |
| 391 | cvs tag date2001-07-17a python |
| 392 | |
| 393 | Merged trunk delta into branch via: |
| 394 | cvs -q -z3 up -j date2001-07-16 -j date2001-07-17a descr |
| 395 | ---------------------------------------------------------------------------- |
| 396 | 2001-07-16 |
| 397 | |
| 398 | Tagged trunk about 15:20 EDT, like so: |
| 399 | cvs tag date2001-07-16 python |
| 400 | |
| 401 | Guido then added all the other dist/ directories to descr-branch from that |
| 402 | trunk tag. |
| 403 | |
| 404 | Tim then merged trunk delta into the branch via: |
| 405 | cvs -q -z3 up -j date2001-07-15 -j date2001-07-16 descr |
| 406 | ---------------------------------------------------------------------------- |
| 407 | 2001-07-15 |
| 408 | |
| 409 | Tagged trunk about 15:44 EDT, like so: |
| 410 | cvs tag date2001-07-15 python |
| 411 | |
| 412 | Merged trunk delta into branch via: |
| 413 | cvs -q -z3 up -j date2001-07-13 -j date2001-07-15 descr |
| 414 | |
| 415 | Four files with conflicts, all artificial RCS Id & Revision thingies. |
| 416 | Resolved and committed. |
| 417 | ---------------------------------------------------------------------------- |
| 418 | 2001-07-13 |
| 419 | |
| 420 | Tagged trunk about 22:13 EDT, like so: |
| 421 | cvs tag date2001-07-13 python |
| 422 | |
| 423 | Merged trunk delta into branch via: |
| 424 | cvs -q -z3 up -j date2001-07-06 -j date2001-07-13 descr |
| 425 | |
| 426 | Six(!) files with conflicts, mostly related to NeilS's generator gc patches. |
| 427 | Unsure why, but CVS seems always to think there are conflicts whenever a |
| 428 | line in a type object decl gets changed, and the conflict marking seems |
| 429 | maximally confused in these cases. Anyway, since I reviewed those patches |
| 430 | on the trunk, good thing I'm merging them, and darned glad it's still fresh |
| 431 | on my mind. |
| 432 | |
| 433 | Resolved the conflicts, and committed the changes in a few hours total. |
| 434 | ---------------------------------------------------------------------------- |
| 435 | 2001-07-07 |
| 436 | |
| 437 | Merge of trunk tag date2001-07-06 into descr-branch, via |
| 438 | cvs -q -z3 up -j date2001-07-06 mergedescr |
| 439 | was committed on 2001-07-07. |
| 440 | |
| 441 | Merge issues: |
| 442 | |
| 443 | (all resolved -- GvR) |
| 444 | ---------------------------------------------------------------------------- |
| 445 | 2001-07-06 |
| 446 | |
| 447 | Tagged trunk a bit after midnight, like so: |
| 448 | |
| 449 | C:\Code>cvs tag date2001-07-06 python |
| 450 | cvs server: Tagging python |
| 451 | cvs server: Tagging python/dist |
| 452 | cvs server: Tagging python/dist/src |
| 453 | T python/dist/src/.cvsignore |
| 454 | T python/dist/src/LICENSE |
| 455 | T python/dist/src/Makefile.pre.in |
| 456 | T python/dist/src/README |
| 457 | ... [& about 3000 lines more] ... |
| 458 | |
| 459 | This is the first trunk snapshot to be merged into the descr-branch. |
| 460 | Gave it a date instead of a goofy name because there's going to be more |
| 461 | than one of these, and at least it's obvious which of two ISO dates comes |
| 462 | earlier. These tags should go away after all merging is complete. |
| 463 | MERGE END ****************************************************************** |