Changeset 388 for python/vendor/current/Include
- Timestamp:
- Mar 19, 2014, 11:11:30 AM (11 years ago)
- Location:
- python/vendor/current/Include
- Files:
-
- 4 added
- 55 edited
Legend:
- Unmodified
- Added
- Removed
-
python/vendor/current/Include/Python-ast.h
r2 r388 186 186 187 187 enum _expr_kind {BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4, 188 IfExp_kind=5, Dict_kind=6, ListComp_kind=7,189 GeneratorExp_kind=8, Yield_kind=9, Compare_kind=10,190 Call_kind=11, Repr_kind=12, Num_kind=13, Str_kind=14,191 Attribute_kind=15, Subscript_kind=16, Name_kind=17,192 List_kind=18, Tuple_kind=19};188 IfExp_kind=5, Dict_kind=6, Set_kind=7, ListComp_kind=8, 189 SetComp_kind=9, DictComp_kind=10, GeneratorExp_kind=11, 190 Yield_kind=12, Compare_kind=13, Call_kind=14, Repr_kind=15, 191 Num_kind=16, Str_kind=17, Attribute_kind=18, 192 Subscript_kind=19, Name_kind=20, List_kind=21, Tuple_kind=22}; 193 193 struct _expr { 194 194 enum _expr_kind kind; … … 227 227 228 228 struct { 229 asdl_seq *elts; 230 } Set; 231 232 struct { 229 233 expr_ty elt; 230 234 asdl_seq *generators; 231 235 } ListComp; 236 237 struct { 238 expr_ty elt; 239 asdl_seq *generators; 240 } SetComp; 241 242 struct { 243 expr_ty key; 244 expr_ty value; 245 asdl_seq *generators; 246 } DictComp; 232 247 233 248 struct { … … 450 465 expr_ty _Py_Dict(asdl_seq * keys, asdl_seq * values, int lineno, int 451 466 col_offset, PyArena *arena); 467 #define Set(a0, a1, a2, a3) _Py_Set(a0, a1, a2, a3) 468 expr_ty _Py_Set(asdl_seq * elts, int lineno, int col_offset, PyArena *arena); 452 469 #define ListComp(a0, a1, a2, a3, a4) _Py_ListComp(a0, a1, a2, a3, a4) 453 470 expr_ty _Py_ListComp(expr_ty elt, asdl_seq * generators, int lineno, int 454 471 col_offset, PyArena *arena); 472 #define SetComp(a0, a1, a2, a3, a4) _Py_SetComp(a0, a1, a2, a3, a4) 473 expr_ty _Py_SetComp(expr_ty elt, asdl_seq * generators, int lineno, int 474 col_offset, PyArena *arena); 475 #define DictComp(a0, a1, a2, a3, a4, a5) _Py_DictComp(a0, a1, a2, a3, a4, a5) 476 expr_ty _Py_DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int 477 lineno, int col_offset, PyArena *arena); 455 478 #define GeneratorExp(a0, a1, a2, a3, a4) _Py_GeneratorExp(a0, a1, a2, a3, a4) 456 479 expr_ty _Py_GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int -
python/vendor/current/Include/Python.h
r2 r388 93 93 #include "rangeobject.h" 94 94 #include "stringobject.h" 95 /* #include "memoryobject.h" */ 95 #include "memoryobject.h" 96 96 #include "bufferobject.h" 97 97 #include "bytesobject.h" … … 108 108 #include "fileobject.h" 109 109 #include "cobject.h" 110 #include "pycapsule.h" 110 111 #include "traceback.h" 111 112 #include "sliceobject.h" … … 135 136 #include "eval.h" 136 137 138 #include "pyctype.h" 137 139 #include "pystrtod.h" 138 140 #include "pystrcmp.h" 141 #include "dtoa.h" 139 142 140 143 /* _Py_Mangle is defined in compile.c */ … … 148 151 #define PyArg_NoArgs(v) PyArg_Parse(v, "") 149 152 150 /* Convert a possibly signed character to a nonnegative int */ 151 /* XXX This assumes characters are 8 bits wide */ 152 #ifdef __CHAR_UNSIGNED__ 153 #define Py_CHARMASK(c) (c) 154 #else 153 /* Argument must be a char or an int in [-128, 127] or [0, 255]. */ 155 154 #define Py_CHARMASK(c) ((unsigned char)((c) & 0xff)) 156 #endif157 155 158 156 #include "pyfpe.h" -
python/vendor/current/Include/abstract.h
r2 r388 33 33 If the programmer wants to get an item from another type of object 34 34 that provides sequence behavior, there is no clear way to do it 35 correctly. 35 correctly. 36 36 37 37 The persistent programmer may peruse object.h and find that the … … 45 45 differ by the type of object being used. Unfortunately, these 46 46 semantics are not clearly described in the current include files. 47 An abstract interface providing more consistent semantics is needed. 47 An abstract interface providing more consistent semantics is needed. 48 48 49 49 Proposal … … 78 78 79 79 From the point of view of Python accessing services provided by C 80 modules: 80 modules: 81 81 82 82 - "Python module interface": this interface consist of the basic … … 134 134 int PyObject_Print(PyObject *o, FILE *fp, int flags); 135 135 136 137 138 options. The only option currently supported is Py_Print_RAW. 139 140 (What should be said about Py_Print_RAW?)136 Print an object, o, on file, fp. Returns -1 on 137 error. The flags argument is used to enable certain printing 138 options. The only option currently supported is Py_Print_RAW. 139 140 (What should be said about Py_Print_RAW?) 141 141 142 142 */ … … 146 146 int PyObject_HasAttrString(PyObject *o, char *attr_name); 147 147 148 149 150 hasattr(o,attr_name). 151 152 148 Returns 1 if o has the attribute attr_name, and 0 otherwise. 149 This is equivalent to the Python expression: 150 hasattr(o,attr_name). 151 152 This function always succeeds. 153 153 154 154 */ … … 158 158 PyObject* PyObject_GetAttrString(PyObject *o, char *attr_name); 159 159 160 161 162 160 Retrieve an attributed named attr_name form object o. 161 Returns the attribute value on success, or NULL on failure. 162 This is the equivalent of the Python expression: o.attr_name. 163 163 164 164 */ … … 168 168 int PyObject_HasAttr(PyObject *o, PyObject *attr_name); 169 169 170 171 172 hasattr(o,attr_name). 173 174 170 Returns 1 if o has the attribute attr_name, and 0 otherwise. 171 This is equivalent to the Python expression: 172 hasattr(o,attr_name). 173 174 This function always succeeds. 175 175 176 176 */ … … 180 180 PyObject* PyObject_GetAttr(PyObject *o, PyObject *attr_name); 181 181 182 183 184 182 Retrieve an attributed named attr_name form object o. 183 Returns the attribute value on success, or NULL on failure. 184 This is the equivalent of the Python expression: o.attr_name. 185 185 186 186 */ … … 191 191 int PyObject_SetAttrString(PyObject *o, char *attr_name, PyObject *v); 192 192 193 194 195 193 Set the value of the attribute named attr_name, for object o, 194 to the value, v. Returns -1 on failure. This is 195 the equivalent of the Python statement: o.attr_name=v. 196 196 197 197 */ … … 201 201 int PyObject_SetAttr(PyObject *o, PyObject *attr_name, PyObject *v); 202 202 203 204 205 203 Set the value of the attribute named attr_name, for object o, 204 to the value, v. Returns -1 on failure. This is 205 the equivalent of the Python statement: o.attr_name=v. 206 206 207 207 */ … … 211 211 int PyObject_DelAttrString(PyObject *o, char *attr_name); 212 212 213 214 215 213 Delete attribute named attr_name, for object o. Returns 214 -1 on failure. This is the equivalent of the Python 215 statement: del o.attr_name. 216 216 217 217 */ … … 222 222 int PyObject_DelAttr(PyObject *o, PyObject *attr_name); 223 223 224 225 226 224 Delete attribute named attr_name, for object o. Returns -1 225 on failure. This is the equivalent of the Python 226 statement: del o.attr_name. 227 227 228 228 */ … … 232 232 233 233 /* 234 235 236 237 238 234 Compare the values of o1 and o2 using a routine provided by 235 o1, if one exists, otherwise with a routine provided by o2. 236 The result of the comparison is returned in result. Returns 237 -1 on failure. This is the equivalent of the Python 238 statement: result=cmp(o1,o2). 239 239 240 240 */ … … 244 244 int PyObject_Compare(PyObject *o1, PyObject *o2); 245 245 246 247 248 249 250 246 Compare the values of o1 and o2 using a routine provided by 247 o1, if one exists, otherwise with a routine provided by o2. 248 Returns the result of the comparison on success. On error, 249 the value returned is undefined. This is equivalent to the 250 Python expression: cmp(o1,o2). 251 251 252 252 */ … … 256 256 PyObject *PyObject_Repr(PyObject *o); 257 257 258 259 260 261 262 258 Compute the string representation of object, o. Returns the 259 string representation on success, NULL on failure. This is 260 the equivalent of the Python expression: repr(o). 261 262 Called by the repr() built-in function and by reverse quotes. 263 263 264 264 */ … … 268 268 PyObject *PyObject_Str(PyObject *o); 269 269 270 271 272 273 274 275 270 Compute the string representation of object, o. Returns the 271 string representation on success, NULL on failure. This is 272 the equivalent of the Python expression: str(o).) 273 274 Called by the str() built-in function and by the print 275 statement. 276 276 277 277 */ … … 281 281 PyObject *PyObject_Unicode(PyObject *o); 282 282 283 284 285 286 287 283 Compute the unicode representation of object, o. Returns the 284 unicode representation on success, NULL on failure. This is 285 the equivalent of the Python expression: unistr(o).) 286 287 Called by the unistr() built-in function. 288 288 289 289 */ … … 293 293 PyAPI_FUNC(int) PyCallable_Check(PyObject *o); 294 294 295 296 297 298 295 Determine if the object, o, is callable. Return 1 if the 296 object is callable and 0 otherwise. 297 298 This function always succeeds. 299 299 300 300 */ … … 303 303 304 304 PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable_object, 305 306 307 /* 308 309 310 311 312 */ 313 305 PyObject *args, PyObject *kw); 306 307 /* 308 Call a callable Python object, callable_object, with 309 arguments and keywords arguments. The 'args' argument can not be 310 NULL, but the 'kw' argument can be NULL. 311 312 */ 313 314 314 PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable_object, 315 315 PyObject *args); 316 316 317 317 /* 318 319 320 321 322 318 Call a callable Python object, callable_object, with 319 arguments given by the tuple, args. If no arguments are 320 needed, then args may be NULL. Returns the result of the 321 call on success, or NULL on failure. This is the equivalent 322 of the Python expression: apply(o,args). 323 323 324 324 */ … … 328 328 329 329 /* 330 331 332 333 334 335 330 Call a callable Python object, callable_object, with a 331 variable number of C arguments. The C arguments are described 332 using a mkvalue-style format string. The format may be NULL, 333 indicating that no arguments are provided. Returns the 334 result of the call on success, or NULL on failure. This is 335 the equivalent of the Python expression: apply(o,args). 336 336 337 337 */ … … 342 342 343 343 /* 344 345 346 347 348 349 344 Call the method named m of object o with a variable number of 345 C arguments. The C arguments are described by a mkvalue 346 format string. The format may be NULL, indicating that no 347 arguments are provided. Returns the result of the call on 348 success, or NULL on failure. This is the equivalent of the 349 Python expression: o.method(args). 350 350 */ 351 351 352 352 PyAPI_FUNC(PyObject *) _PyObject_CallFunction_SizeT(PyObject *callable, 353 353 char *format, ...); 354 354 PyAPI_FUNC(PyObject *) _PyObject_CallMethod_SizeT(PyObject *o, 355 356 355 char *name, 356 char *format, ...); 357 357 358 358 PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable, … … 360 360 361 361 /* 362 363 364 365 366 362 Call a callable Python object, callable_object, with a 363 variable number of C arguments. The C arguments are provided 364 as PyObject * values, terminated by a NULL. Returns the 365 result of the call on success, or NULL on failure. This is 366 the equivalent of the Python expression: apply(o,args). 367 367 */ 368 368 … … 372 372 373 373 /* 374 375 376 377 378 374 Call the method named m of object o with a variable number of 375 C arguments. The C arguments are provided as PyObject * 376 values, terminated by NULL. Returns the result of the call 377 on success, or NULL on failure. This is the equivalent of 378 the Python expression: o.method(args). 379 379 */ 380 380 … … 384 384 long PyObject_Hash(PyObject *o); 385 385 386 387 388 386 Compute and return the hash, hash_value, of an object, o. On 387 failure, return -1. This is the equivalent of the Python 388 expression: hash(o). 389 389 390 390 */ … … 395 395 int PyObject_IsTrue(PyObject *o); 396 396 397 398 399 397 Returns 1 if the object, o, is considered to be true, 0 if o is 398 considered to be false and -1 on failure. This is equivalent to the 399 Python expression: not not o 400 400 401 401 */ … … 405 405 int PyObject_Not(PyObject *o); 406 406 407 408 409 407 Returns 0 if the object, o, is considered to be true, 1 if o is 408 considered to be false and -1 on failure. This is equivalent to the 409 Python expression: not o 410 410 411 411 */ … … 414 414 415 415 /* 416 417 418 416 On success, returns a type object corresponding to the object 417 type of object o. On failure, returns NULL. This is 418 equivalent to the Python expression: type(o). 419 419 */ 420 420 … … 422 422 423 423 /* 424 425 426 427 424 Return the size of object o. If the object, o, provides 425 both sequence and mapping protocols, the sequence size is 426 returned. On error, -1 is returned. This is the equivalent 427 to the Python expression: len(o). 428 428 429 429 */ … … 437 437 438 438 /* 439 440 441 439 Guess the size of object o using len(o) or o.__length_hint__(). 440 If neither of those return a non-negative value, then return the 441 default value. If one of the calls fails, this function returns -1. 442 442 */ 443 443 … … 445 445 446 446 /* 447 448 449 447 Return element of o corresponding to the object, key, or NULL 448 on failure. This is the equivalent of the Python expression: 449 o[key]. 450 450 451 451 */ … … 454 454 455 455 /* 456 457 458 456 Map the object, key, to the value, v. Returns 457 -1 on failure. This is the equivalent of the Python 458 statement: o[key]=v. 459 459 */ 460 460 … … 462 462 463 463 /* 464 465 466 464 Remove the mapping for object, key, from the object *o. 465 Returns -1 on failure. This is equivalent to 466 the Python statement: del o[key]. 467 467 */ 468 468 … … 470 470 471 471 /* 472 473 472 Delete the mapping for key from *o. Returns -1 on failure. 473 This is the equivalent of the Python statement: del o[key]. 474 474 */ 475 475 476 476 PyAPI_FUNC(int) PyObject_AsCharBuffer(PyObject *obj, 477 478 479 480 /* 481 482 483 484 485 486 487 488 477 const char **buffer, 478 Py_ssize_t *buffer_len); 479 480 /* 481 Takes an arbitrary object which must support the (character, 482 single segment) buffer interface and returns a pointer to a 483 read-only memory location useable as character based input 484 for subsequent processing. 485 486 0 is returned on success. buffer and buffer_len are only 487 set in case no error occurs. Otherwise, -1 is returned and 488 an exception set. 489 489 490 490 */ … … 492 492 PyAPI_FUNC(int) PyObject_CheckReadBuffer(PyObject *obj); 493 493 494 /* 495 496 497 494 /* 495 Checks whether an arbitrary object supports the (character, 496 single segment) buffer interface. Returns 1 on success, 0 497 on failure. 498 498 499 499 */ 500 500 501 501 PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj, 502 503 504 505 /* 506 507 508 509 510 511 512 set in case no error occurrs. Otherwise, -1 is returned and513 502 const void **buffer, 503 Py_ssize_t *buffer_len); 504 505 /* 506 Same as PyObject_AsCharBuffer() except that this API expects 507 (readable, single segment) buffer interface and returns a 508 pointer to a read-only memory location which can contain 509 arbitrary data. 510 511 0 is returned on success. buffer and buffer_len are only 512 set in case no error occurs. Otherwise, -1 is returned and 513 an exception set. 514 514 515 515 */ 516 516 517 517 PyAPI_FUNC(int) PyObject_AsWriteBuffer(PyObject *obj, 518 519 520 521 /* 522 523 524 525 526 527 set in case no error occurrs. Otherwise, -1 is returned and528 529 530 */ 531 532 518 void **buffer, 519 Py_ssize_t *buffer_len); 520 521 /* 522 Takes an arbitrary object which must support the (writeable, 523 single segment) buffer interface and returns a pointer to a 524 writeable memory location in buffer of size buffer_len. 525 526 0 is returned on success. buffer and buffer_len are only 527 set in case no error occurs. Otherwise, -1 is returned and 528 an exception set. 529 530 */ 531 532 /* new buffer API */ 533 533 534 534 #define PyObject_CheckBuffer(obj) \ 535 (((obj)->ob_type->tp_as_buffer != NULL) &&\536 537 538 539 /* Return 1 if the getbuffer function is available, otherwise 540 541 542 PyAPI_FUNC(int) PyObject_GetBuffer(PyObject *obj, Py_buffer *view, 543 544 545 546 547 call. Returns -1 and raises an error on failure and returns 0 on 548 549 535 (((obj)->ob_type->tp_as_buffer != NULL) && \ 536 (PyType_HasFeature((obj)->ob_type, Py_TPFLAGS_HAVE_NEWBUFFER)) && \ 537 ((obj)->ob_type->tp_as_buffer->bf_getbuffer != NULL)) 538 539 /* Return 1 if the getbuffer function is available, otherwise 540 return 0 */ 541 542 PyAPI_FUNC(int) PyObject_GetBuffer(PyObject *obj, Py_buffer *view, 543 int flags); 544 545 /* This is a C-API version of the getbuffer function call. It checks 546 to make sure object has the required function pointer and issues the 547 call. Returns -1 and raises an error on failure and returns 0 on 548 success 549 */ 550 550 551 551 552 552 PyAPI_FUNC(void *) PyBuffer_GetPointer(Py_buffer *view, Py_ssize_t *indices); 553 554 /* Get the memory area pointed to by the indices for the buffer given.555 Note that view->ndim is the assumed size of indices556 553 554 /* Get the memory area pointed to by the indices for the buffer given. 555 Note that view->ndim is the assumed size of indices 556 */ 557 557 558 558 PyAPI_FUNC(int) PyBuffer_SizeFromFormat(const char *); 559 560 /* Return the implied itemsize of the data-format area from a 561 562 563 564 559 560 /* Return the implied itemsize of the data-format area from a 561 struct-style description */ 562 563 564 565 565 PyAPI_FUNC(int) PyBuffer_ToContiguous(void *buf, Py_buffer *view, 566 567 568 PyAPI_FUNC(int) PyBuffer_FromContiguous(Py_buffer *view, void *buf, 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 566 Py_ssize_t len, char fort); 567 568 PyAPI_FUNC(int) PyBuffer_FromContiguous(Py_buffer *view, void *buf, 569 Py_ssize_t len, char fort); 570 571 572 /* Copy len bytes of data from the contiguous chunk of memory 573 pointed to by buf into the buffer exported by obj. Return 574 0 on success and return -1 and raise a PyBuffer_Error on 575 error (i.e. the object does not have a buffer interface or 576 it is not working). 577 578 If fort is 'F' and the object is multi-dimensional, 579 then the data will be copied into the array in 580 Fortran-style (first dimension varies the fastest). If 581 fort is 'C', then the data will be copied into the array 582 in C-style (last dimension varies the fastest). If fort 583 is 'A', then it does not matter and the copy will be made 584 in whatever way is more efficient. 585 586 */ 587 587 588 588 PyAPI_FUNC(int) PyObject_CopyData(PyObject *dest, PyObject *src); 589 590 591 589 590 /* Copy the data from the src buffer to the buffer of destination 591 */ 592 592 593 593 PyAPI_FUNC(int) PyBuffer_IsContiguous(Py_buffer *view, char fort); 594 594 595 595 596 PyAPI_FUNC(void) PyBuffer_FillContiguousStrides(int ndims, 597 Py_ssize_t *shape, 598 599 600 601 602 603 604 605 606 596 PyAPI_FUNC(void) PyBuffer_FillContiguousStrides(int ndims, 597 Py_ssize_t *shape, 598 Py_ssize_t *strides, 599 int itemsize, 600 char fort); 601 602 /* Fill the strides array with byte-strides of a contiguous 603 (Fortran-style if fort is 'F' or C-style otherwise) 604 array of the given shape with the given number of bytes 605 per element. 606 */ 607 607 608 608 PyAPI_FUNC(int) PyBuffer_FillInfo(Py_buffer *view, PyObject *o, void *buf, 609 610 611 612 613 614 615 616 609 Py_ssize_t len, int readonly, 610 int flags); 611 612 /* Fills in a buffer-info structure correctly for an exporter 613 that can only share a contiguous chunk of memory of 614 "unsigned bytes" of the given length. Returns 0 on success 615 and -1 (with raising an error) on error. 616 */ 617 617 618 618 PyAPI_FUNC(void) PyBuffer_Release(Py_buffer *view); 619 619 620 620 /* Releases a Py_buffer obtained from getbuffer ParseTuple's s*. 621 621 */ 622 622 623 623 PyAPI_FUNC(PyObject *) PyObject_Format(PyObject* obj, 624 625 /* 626 627 624 PyObject *format_spec); 625 /* 626 Takes an arbitrary object and returns the result of 627 calling obj.__format__(format_spec). 628 628 */ 629 629 … … 632 632 PyAPI_FUNC(PyObject *) PyObject_GetIter(PyObject *); 633 633 /* Takes an object and returns an iterator for it. 634 635 634 This is typically a new iterator but if the argument 635 is an iterator, this returns itself. */ 636 636 637 637 #define PyIter_Check(obj) \ 638 638 (PyType_HasFeature((obj)->ob_type, Py_TPFLAGS_HAVE_ITER) && \ 639 (obj)->ob_type->tp_iternext != NULL) 639 (obj)->ob_type->tp_iternext != NULL && \ 640 (obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented) 640 641 641 642 PyAPI_FUNC(PyObject *) PyIter_Next(PyObject *); 642 643 /* Takes an iterator object and calls its tp_iternext slot, 643 644 645 644 returning the next value. If the iterator is exhausted, 645 this returns NULL without setting an exception. 646 NULL with an exception means an error occurred. */ 646 647 647 648 /* Number Protocol:*/ … … 650 651 651 652 /* 652 653 false otherwise. 654 655 653 Returns 1 if the object, o, provides numeric protocols, and 654 false otherwise. 655 656 This function always succeeds. 656 657 657 658 */ … … 660 661 661 662 /* 662 663 663 Returns the result of adding o1 and o2, or null on failure. 664 This is the equivalent of the Python expression: o1+o2. 664 665 665 666 … … 669 670 670 671 /* 671 672 673 672 Returns the result of subtracting o2 from o1, or null on 673 failure. This is the equivalent of the Python expression: 674 o1-o2. 674 675 675 676 */ … … 678 679 679 680 /* 680 681 682 681 Returns the result of multiplying o1 and o2, or null on 682 failure. This is the equivalent of the Python expression: 683 o1*o2. 683 684 684 685 … … 688 689 689 690 /* 690 691 691 Returns the result of dividing o1 by o2, or null on failure. 692 This is the equivalent of the Python expression: o1/o2. 692 693 693 694 … … 697 698 698 699 /* 699 700 701 700 Returns the result of dividing o1 by o2 giving an integral result, 701 or null on failure. 702 This is the equivalent of the Python expression: o1//o2. 702 703 703 704 … … 707 708 708 709 /* 709 710 711 710 Returns the result of dividing o1 by o2 giving a float result, 711 or null on failure. 712 This is the equivalent of the Python expression: o1/o2. 712 713 713 714 … … 717 718 718 719 /* 719 720 721 720 Returns the remainder of dividing o1 by o2, or null on 721 failure. This is the equivalent of the Python expression: 722 o1%o2. 722 723 723 724 … … 727 728 728 729 /* 729 730 731 730 See the built-in function divmod. Returns NULL on failure. 731 This is the equivalent of the Python expression: 732 divmod(o1,o2). 732 733 733 734 … … 738 739 739 740 /* 740 741 742 741 See the built-in function pow. Returns NULL on failure. 742 This is the equivalent of the Python expression: 743 pow(o1,o2,o3), where o3 is optional. 743 744 744 745 */ … … 747 748 748 749 /* 749 750 750 Returns the negation of o on success, or null on failure. 751 This is the equivalent of the Python expression: -o. 751 752 752 753 */ … … 755 756 756 757 /* 757 758 758 Returns the (what?) of o on success, or NULL on failure. 759 This is the equivalent of the Python expression: +o. 759 760 760 761 */ … … 763 764 764 765 /* 765 766 766 Returns the absolute value of o, or null on failure. This is 767 the equivalent of the Python expression: abs(o). 767 768 768 769 */ … … 771 772 772 773 /* 773 774 775 774 Returns the bitwise negation of o on success, or NULL on 775 failure. This is the equivalent of the Python expression: 776 ~o. 776 777 777 778 … … 781 782 782 783 /* 783 784 785 784 Returns the result of left shifting o1 by o2 on success, or 785 NULL on failure. This is the equivalent of the Python 786 expression: o1 << o2. 786 787 787 788 … … 791 792 792 793 /* 793 794 795 794 Returns the result of right shifting o1 by o2 on success, or 795 NULL on failure. This is the equivalent of the Python 796 expression: o1 >> o2. 796 797 797 798 */ … … 800 801 801 802 /* 802 803 804 803 Returns the result of bitwise and of o1 and o2 on success, or 804 NULL on failure. This is the equivalent of the Python 805 expression: o1&o2. 805 806 806 807 … … 810 811 811 812 /* 812 813 814 813 Returns the bitwise exclusive or of o1 by o2 on success, or 814 NULL on failure. This is the equivalent of the Python 815 expression: o1^o2. 815 816 816 817 … … 820 821 821 822 /* 822 823 824 823 Returns the result of bitwise or on o1 and o2 on success, or 824 NULL on failure. This is the equivalent of the Python 825 expression: o1|o2. 825 826 826 827 */ … … 830 831 int PyNumber_Coerce(PyObject **p1, PyObject **p2); 831 832 832 833 834 835 836 837 838 839 840 841 842 843 833 This function takes the addresses of two variables of type 834 PyObject*. 835 836 If the objects pointed to by *p1 and *p2 have the same type, 837 increment their reference count and return 0 (success). 838 If the objects can be converted to a common numeric type, 839 replace *p1 and *p2 by their converted value (with 'new' 840 reference counts), and return 0. 841 If no conversion is possible, or if some other error occurs, 842 return -1 (failure) and don't increment the reference counts. 843 The call PyNumber_Coerce(&o1, &o2) is equivalent to the Python 844 statement o1, o2 = coerce(o1, o2). 844 845 845 846 */ … … 849 850 PyType_HasFeature((obj)->ob_type, Py_TPFLAGS_HAVE_INDEX) && \ 850 851 (obj)->ob_type->tp_as_number->nb_index != NULL) 851 852 852 853 PyAPI_FUNC(PyObject *) PyNumber_Index(PyObject *o); 853 854 854 855 /* 855 856 856 Returns the object converted to a Python long or int 857 or NULL with an error raised on failure. 857 858 */ 858 859 … … 860 861 861 862 /* 862 863 864 865 866 867 863 Returns the Integral instance converted to an int. The 864 instance is expected to be int or long or have an __int__ 865 method. Steals integral's reference. error_format will be 866 used to create the TypeError if integral isn't actually an 867 Integral instance. error_format should be a format string 868 that can accept a char* naming integral's type. 868 869 */ 869 870 870 871 PyAPI_FUNC(PyObject *) _PyNumber_ConvertIntegralToInt( 871 872 873 874 /* 875 876 877 878 879 is cleared and the value is clipped.872 PyObject *integral, 873 const char* error_format); 874 875 /* 876 Returns the object converted to Py_ssize_t by going through 877 PyNumber_Index first. If an overflow error occurs while 878 converting the int-or-long to Py_ssize_t, then the second argument 879 is the error-type to return. If it is NULL, then the overflow error 880 is cleared and the value is clipped. 880 881 */ 881 882 … … 883 884 884 885 /* 885 886 887 886 Returns the o converted to an integer object on success, or 887 NULL on failure. This is the equivalent of the Python 888 expression: int(o). 888 889 889 890 */ … … 892 893 893 894 /* 894 895 896 895 Returns the o converted to a long integer object on success, 896 or NULL on failure. This is the equivalent of the Python 897 expression: long(o). 897 898 898 899 */ … … 901 902 902 903 /* 903 904 905 906 */ 907 904 Returns the o converted to a float object on success, or NULL 905 on failure. This is the equivalent of the Python expression: 906 float(o). 907 */ 908 908 909 /* In-place variants of (some of) the above number protocol functions */ 909 910 … … 911 912 912 913 /* 913 914 915 914 Returns the result of adding o2 to o1, possibly in-place, or null 915 on failure. This is the equivalent of the Python expression: 916 o1 += o2. 916 917 917 918 */ … … 920 921 921 922 /* 922 923 924 923 Returns the result of subtracting o2 from o1, possibly in-place or 924 null on failure. This is the equivalent of the Python expression: 925 o1 -= o2. 925 926 926 927 */ … … 929 930 930 931 /* 931 932 933 932 Returns the result of multiplying o1 by o2, possibly in-place, or 933 null on failure. This is the equivalent of the Python expression: 934 o1 *= o2. 934 935 935 936 */ … … 938 939 939 940 /* 940 941 942 941 Returns the result of dividing o1 by o2, possibly in-place, or null 942 on failure. This is the equivalent of the Python expression: 943 o1 /= o2. 943 944 944 945 */ 945 946 946 947 PyAPI_FUNC(PyObject *) PyNumber_InPlaceFloorDivide(PyObject *o1, 947 948 949 /* 950 951 952 953 948 PyObject *o2); 949 950 /* 951 Returns the result of dividing o1 by o2 giving an integral result, 952 possibly in-place, or null on failure. 953 This is the equivalent of the Python expression: 954 o1 /= o2. 954 955 955 956 */ 956 957 957 958 PyAPI_FUNC(PyObject *) PyNumber_InPlaceTrueDivide(PyObject *o1, 958 959 960 /* 961 962 963 964 959 PyObject *o2); 960 961 /* 962 Returns the result of dividing o1 by o2 giving a float result, 963 possibly in-place, or null on failure. 964 This is the equivalent of the Python expression: 965 o1 /= o2. 965 966 966 967 */ … … 969 970 970 971 /* 971 972 973 972 Returns the remainder of dividing o1 by o2, possibly in-place, or 973 null on failure. This is the equivalent of the Python expression: 974 o1 %= o2. 974 975 975 976 */ 976 977 977 978 PyAPI_FUNC(PyObject *) PyNumber_InPlacePower(PyObject *o1, PyObject *o2, 978 979 980 /* 981 982 983 979 PyObject *o3); 980 981 /* 982 Returns the result of raising o1 to the power of o2, possibly 983 in-place, or null on failure. This is the equivalent of the Python 984 expression: o1 **= o2, or pow(o1, o2, o3) if o3 is present. 984 985 985 986 */ … … 988 989 989 990 /* 990 991 992 991 Returns the result of left shifting o1 by o2, possibly in-place, or 992 null on failure. This is the equivalent of the Python expression: 993 o1 <<= o2. 993 994 994 995 */ … … 997 998 998 999 /* 999 1000 1001 1000 Returns the result of right shifting o1 by o2, possibly in-place or 1001 null on failure. This is the equivalent of the Python expression: 1002 o1 >>= o2. 1002 1003 1003 1004 */ … … 1006 1007 1007 1008 /* 1008 1009 1010 1009 Returns the result of bitwise and of o1 and o2, possibly in-place, 1010 or null on failure. This is the equivalent of the Python 1011 expression: o1 &= o2. 1011 1012 1012 1013 */ … … 1015 1016 1016 1017 /* 1017 1018 1019 1018 Returns the bitwise exclusive or of o1 by o2, possibly in-place, or 1019 null on failure. This is the equivalent of the Python expression: 1020 o1 ^= o2. 1020 1021 1021 1022 */ … … 1024 1025 1025 1026 /* 1026 1027 1028 1027 Returns the result of bitwise or of o1 and o2, possibly in-place, 1028 or null on failure. This is the equivalent of the Python 1029 expression: o1 |= o2. 1029 1030 1030 1031 */ … … 1034 1035 1035 1036 /* 1036 1037 1038 1037 Returns the integer n converted to a string with a base, with a base 1038 marker of 0b, 0o or 0x prefixed if applicable. 1039 If n is not an int object, it is converted with PyNumber_Index first. 1039 1040 */ 1040 1041 … … 1045 1046 1046 1047 /* 1047 1048 otherwise. 1049 1050 1048 Return 1 if the object provides sequence protocol, and zero 1049 otherwise. 1050 1051 This function always succeeds. 1051 1052 1052 1053 */ … … 1055 1056 1056 1057 /* 1057 1058 Return the size of sequence object o, or -1 on failure. 1058 1059 1059 1060 */ … … 1068 1069 1069 1070 /* 1070 1071 1072 1071 Return the concatenation of o1 and o2 on success, and NULL on 1072 failure. This is the equivalent of the Python 1073 expression: o1+o2. 1073 1074 1074 1075 */ … … 1077 1078 1078 1079 /* 1079 1080 1081 1080 Return the result of repeating sequence object o count times, 1081 or NULL on failure. This is the equivalent of the Python 1082 expression: o1*count. 1082 1083 1083 1084 */ … … 1086 1087 1087 1088 /* 1088 1089 1089 Return the ith element of o, or NULL on failure. This is the 1090 equivalent of the Python expression: o[i]. 1090 1091 */ 1091 1092 … … 1093 1094 1094 1095 /* 1095 1096 1097 1096 Return the slice of sequence object o between i1 and i2, or 1097 NULL on failure. This is the equivalent of the Python 1098 expression: o[i1:i2]. 1098 1099 1099 1100 */ … … 1102 1103 1103 1104 /* 1104 1105 1106 1105 Assign object v to the ith element of o. Returns 1106 -1 on failure. This is the equivalent of the Python 1107 statement: o[i]=v. 1107 1108 1108 1109 */ … … 1111 1112 1112 1113 /* 1113 1114 1115 1114 Delete the ith element of object v. Returns 1115 -1 on failure. This is the equivalent of the Python 1116 statement: del o[i]. 1116 1117 */ 1117 1118 … … 1120 1121 1121 1122 /* 1122 1123 1124 1123 Assign the sequence object, v, to the slice in sequence 1124 object, o, from i1 to i2. Returns -1 on failure. This is the 1125 equivalent of the Python statement: o[i1:i2]=v. 1125 1126 */ 1126 1127 … … 1128 1129 1129 1130 /* 1130 1131 1132 1131 Delete the slice in sequence object, o, from i1 to i2. 1132 Returns -1 on failure. This is the equivalent of the Python 1133 statement: del o[i1:i2]. 1133 1134 */ 1134 1135 … … 1136 1137 1137 1138 /* 1138 1139 1139 Returns the sequence, o, as a tuple on success, and NULL on failure. 1140 This is equivalent to the Python expression: tuple(o) 1140 1141 */ 1141 1142 … … 1143 1144 PyAPI_FUNC(PyObject *) PySequence_List(PyObject *o); 1144 1145 /* 1145 1146 1146 Returns the sequence, o, as a list on success, and NULL on failure. 1147 This is equivalent to the Python expression: list(o) 1147 1148 */ 1148 1149 1149 1150 PyAPI_FUNC(PyObject *) PySequence_Fast(PyObject *o, const char* m); 1150 1151 /* 1151 1152 1153 1154 1155 1156 1152 Returns the sequence, o, as a tuple, unless it's already a 1153 tuple or list. Use PySequence_Fast_GET_ITEM to access the 1154 members of this list, and PySequence_Fast_GET_SIZE to get its length. 1155 1156 Returns NULL on failure. If the object does not support iteration, 1157 raises a TypeError exception with m as the message text. 1157 1158 */ 1158 1159 1159 1160 #define PySequence_Fast_GET_SIZE(o) \ 1160 1161 /* 1162 1163 1161 (PyList_Check(o) ? PyList_GET_SIZE(o) : PyTuple_GET_SIZE(o)) 1162 /* 1163 Return the size of o, assuming that o was returned by 1164 PySequence_Fast and is not NULL. 1164 1165 */ 1165 1166 … … 1167 1168 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i)) 1168 1169 /* 1169 1170 1170 Return the ith element of o, assuming that o was returned by 1171 PySequence_Fast, and that i is within bounds. 1171 1172 */ 1172 1173 1173 1174 #define PySequence_ITEM(o, i)\ 1174 1175 ( Py_TYPE(o)->tp_as_sequence->sq_item(o, i) ) 1175 1176 /* Assume tp_as_sequence and sq_item exist and that i does not 1176 1177 */ 1177 need to be corrected for a negative index 1178 */ 1178 1179 1179 1180 #define PySequence_Fast_ITEMS(sf) \ 1180 1181 1182 1183 1181 (PyList_Check(sf) ? ((PyListObject *)(sf))->ob_item \ 1182 : ((PyTupleObject *)(sf))->ob_item) 1183 /* Return a pointer to the underlying item array for 1184 an object retured by PySequence_Fast */ 1184 1185 1185 1186 PyAPI_FUNC(Py_ssize_t) PySequence_Count(PyObject *o, PyObject *value); 1186 1187 1187 1188 /* 1188 1189 1190 1191 1189 Return the number of occurrences on value on o, that is, 1190 return the number of keys for which o[key]==value. On 1191 failure, return -1. This is equivalent to the Python 1192 expression: o.count(value). 1192 1193 */ 1193 1194 1194 1195 PyAPI_FUNC(int) PySequence_Contains(PyObject *seq, PyObject *ob); 1195 1196 /* 1196 1197 1197 Return -1 if error; 1 if ob in seq; 0 if ob not in seq. 1198 Use __contains__ if possible, else _PySequence_IterSearch(). 1198 1199 */ 1199 1200 … … 1202 1203 #define PY_ITERSEARCH_CONTAINS 3 1203 1204 PyAPI_FUNC(Py_ssize_t) _PySequence_IterSearch(PyObject *seq, 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1205 PyObject *obj, int operation); 1206 /* 1207 Iterate over seq. Result depends on the operation: 1208 PY_ITERSEARCH_COUNT: return # of times obj appears in seq; -1 if 1209 error. 1210 PY_ITERSEARCH_INDEX: return 0-based index of first occurrence of 1211 obj in seq; set ValueError and return -1 if none found; 1212 also return -1 on error. 1213 PY_ITERSEARCH_CONTAINS: return 1 if obj in seq, else 0; -1 on 1214 error. 1215 */ 1215 1216 1216 1217 /* For DLL-level backwards compatibility */ … … 1222 1223 1223 1224 /* 1224 1225 1226 1225 Determine if o contains value. If an item in o is equal to 1226 X, return 1, otherwise return 0. On error, return -1. This 1227 is equivalent to the Python expression: value in o. 1227 1228 */ 1228 1229 … … 1230 1231 1231 1232 /* 1232 1233 1234 1233 Return the first index for which o[i]=value. On error, 1234 return -1. This is equivalent to the Python 1235 expression: o.index(value). 1235 1236 */ 1236 1237 … … 1240 1241 1241 1242 /* 1242 1243 1244 1243 Append o2 to o1, in-place when possible. Return the resulting 1244 object, which could be o1, or NULL on failure. This is the 1245 equivalent of the Python expression: o1 += o2. 1245 1246 1246 1247 */ … … 1249 1250 1250 1251 /* 1251 1252 1253 1252 Repeat o1 by count, in-place when possible. Return the resulting 1253 object, which could be o1, or NULL on failure. This is the 1254 equivalent of the Python expression: o1 *= count. 1254 1255 1255 1256 */ … … 1260 1261 1261 1262 /* 1262 1263 otherwise. 1264 1265 1263 Return 1 if the object provides mapping protocol, and zero 1264 otherwise. 1265 1266 This function always succeeds. 1266 1267 */ 1267 1268 … … 1269 1270 1270 1271 /* 1271 1272 1273 1272 Returns the number of keys in object o on success, and -1 on 1273 failure. For objects that do not provide sequence protocol, 1274 this is equivalent to the Python expression: len(o). 1274 1275 */ 1275 1276 … … 1284 1285 int PyMapping_DelItemString(PyObject *o, char *key); 1285 1286 1286 1287 1288 1287 Remove the mapping for object, key, from the object *o. 1288 Returns -1 on failure. This is equivalent to 1289 the Python statement: del o[key]. 1289 1290 */ 1290 1291 #define PyMapping_DelItemString(O,K) PyObject_DelItemString((O),(K)) … … 1294 1295 int PyMapping_DelItem(PyObject *o, PyObject *key); 1295 1296 1296 1297 1298 1297 Remove the mapping for object, key, from the object *o. 1298 Returns -1 on failure. This is equivalent to 1299 the Python statement: del o[key]. 1299 1300 */ 1300 1301 #define PyMapping_DelItem(O,K) PyObject_DelItem((O),(K)) … … 1303 1304 1304 1305 /* 1305 1306 1307 o.has_key(key). 1308 1309 1306 On success, return 1 if the mapping object has the key, key, 1307 and 0 otherwise. This is equivalent to the Python expression: 1308 o.has_key(key). 1309 1310 This function always succeeds. 1310 1311 */ 1311 1312 … … 1313 1314 1314 1315 /* 1315 1316 1317 o.has_key(key). 1318 1319 1316 Return 1 if the mapping object has the key, key, 1317 and 0 otherwise. This is equivalent to the Python expression: 1318 o.has_key(key). 1319 1320 This function always succeeds. 1320 1321 1321 1322 */ … … 1325 1326 PyObject *PyMapping_Keys(PyObject *o); 1326 1327 1327 1328 1329 1328 On success, return a list of the keys in object o. On 1329 failure, return NULL. This is equivalent to the Python 1330 expression: o.keys(). 1330 1331 */ 1331 1332 #define PyMapping_Keys(O) PyObject_CallMethod(O,"keys",NULL) … … 1335 1336 PyObject *PyMapping_Values(PyObject *o); 1336 1337 1337 1338 1339 1338 On success, return a list of the values in object o. On 1339 failure, return NULL. This is equivalent to the Python 1340 expression: o.values(). 1340 1341 */ 1341 1342 #define PyMapping_Values(O) PyObject_CallMethod(O,"values",NULL) … … 1345 1346 PyObject *PyMapping_Items(PyObject *o); 1346 1347 1347 1348 1349 1350 1348 On success, return a list of the items in object o, where 1349 each item is a tuple containing a key-value pair. On 1350 failure, return NULL. This is equivalent to the Python 1351 expression: o.items(). 1351 1352 1352 1353 */ … … 1356 1357 1357 1358 /* 1358 1359 1360 1359 Return element of o corresponding to the object, key, or NULL 1360 on failure. This is the equivalent of the Python expression: 1361 o[key]. 1361 1362 */ 1362 1363 … … 1365 1366 1366 1367 /* 1367 Map the object, key, to the value, v. Returns 1368 1369 1368 Map the object, key, to the value, v. Returns 1369 -1 on failure. This is the equivalent of the Python 1370 statement: o[key]=v. 1370 1371 */ 1371 1372 … … 1381 1382 1382 1383 PyAPI_FUNC(int) _PyObject_RealIsSubclass(PyObject *derived, PyObject *cls); 1384 1385 1386 /* For internal use by buffer API functions */ 1387 PyAPI_FUNC(void) _Py_add_one_to_index_F(int nd, Py_ssize_t *index, 1388 const Py_ssize_t *shape); 1389 PyAPI_FUNC(void) _Py_add_one_to_index_C(int nd, Py_ssize_t *index, 1390 const Py_ssize_t *shape); 1383 1391 1384 1392 -
python/vendor/current/Include/bytes_methods.h
r2 r388 35 35 extern const char _Py_swapcase__doc__[]; 36 36 37 #define FLAG_LOWER 0x01 38 #define FLAG_UPPER 0x02 39 #define FLAG_ALPHA (FLAG_LOWER|FLAG_UPPER) 40 #define FLAG_DIGIT 0x04 41 #define FLAG_ALNUM (FLAG_ALPHA|FLAG_DIGIT) 42 #define FLAG_SPACE 0x08 43 #define FLAG_XDIGIT 0x10 44 45 extern const unsigned int _Py_ctype_table[256]; 46 47 #define ISLOWER(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_LOWER) 48 #define ISUPPER(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_UPPER) 49 #define ISALPHA(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_ALPHA) 50 #define ISDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_DIGIT) 51 #define ISXDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_XDIGIT) 52 #define ISALNUM(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_ALNUM) 53 #define ISSPACE(c) (_Py_ctype_table[Py_CHARMASK(c)] & FLAG_SPACE) 37 /* These are left in for backward compatibility and will be removed 38 in 2.8/3.2 */ 39 #define ISLOWER(c) Py_ISLOWER(c) 40 #define ISUPPER(c) Py_ISUPPER(c) 41 #define ISALPHA(c) Py_ISALPHA(c) 42 #define ISDIGIT(c) Py_ISDIGIT(c) 43 #define ISXDIGIT(c) Py_ISXDIGIT(c) 44 #define ISALNUM(c) Py_ISALNUM(c) 45 #define ISSPACE(c) Py_ISSPACE(c) 54 46 55 47 #undef islower … … 68 60 #define isspace(c) undefined_isspace(c) 69 61 70 extern const unsigned char _Py_ctype_tolower[256]; 71 extern const unsigned char _Py_ctype_toupper[256]; 72 73 #define TOLOWER(c) (_Py_ctype_tolower[Py_CHARMASK(c)]) 74 #define TOUPPER(c) (_Py_ctype_toupper[Py_CHARMASK(c)]) 62 /* These are left in for backward compatibility and will be removed 63 in 2.8/3.2 */ 64 #define TOLOWER(c) Py_TOLOWER(c) 65 #define TOUPPER(c) Py_TOUPPER(c) 75 66 76 67 #undef tolower -
python/vendor/current/Include/bytesobject.h
r2 r388 24 24 #define PyBytes_DecodeEscape PyString_DecodeEscape 25 25 #define _PyBytes_Join _PyString_Join 26 #define PyBytes_Decode PyString_Decode27 #define PyBytes_Encode PyString_Encode28 #define PyBytes_AsEncodedObject PyString_AsEncodedObject29 #define PyBytes_AsEncodedString PyString_AsEncodedString30 #define PyBytes_AsDecodedObject PyString_AsDecodedObject31 #define PyBytes_AsDecodedString PyString_AsDecodedString32 26 #define PyBytes_AsStringAndSize PyString_AsStringAndSize 33 27 #define _PyBytes_InsertThousandsGrouping _PyString_InsertThousandsGrouping -
python/vendor/current/Include/cStringIO.h
r2 r388 8 8 This header provides access to cStringIO objects from C. 9 9 Functions are provided for calling cStringIO objects and 10 macros are provided for testing whether you have cStringIO 10 macros are provided for testing whether you have cStringIO 11 11 objects. 12 12 … … 19 19 20 20 */ 21 22 #define PycStringIO_CAPSULE_NAME "cStringIO.cStringIO_CAPI" 23 21 24 #define PycString_IMPORT \ 22 PycStringIO = ( struct PycStringIO_CAPI*)PyCObject_Import("cStringIO",\23 "cStringIO_CAPI")25 PycStringIO = ((struct PycStringIO_CAPI*)PyCapsule_Import(\ 26 PycStringIO_CAPSULE_NAME, 0)) 24 27 25 28 /* Basic functions to manipulate cStringIO objects from C */ 26 29 27 30 static struct PycStringIO_CAPI { 28 31 29 32 /* Read a string from an input object. If the last argument 30 33 is -1, the remainder will be read. -
python/vendor/current/Include/ceval.h
r2 r388 9 9 10 10 PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords( 11 PyObject *, PyObject *, PyObject *); 12 13 /* DLL-level Backwards compatibility: */ 14 #undef PyEval_CallObject 15 PyAPI_FUNC(PyObject *) PyEval_CallObject(PyObject *, PyObject *); 11 PyObject *, PyObject *, PyObject *); 16 12 17 13 /* Inline this */ 18 14 #define PyEval_CallObject(func,arg) \ 19 15 PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL) 20 16 21 17 PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *obj, … … 51 47 52 48 #define Py_EnterRecursiveCall(where) \ 53 54 55 #define Py_LeaveRecursiveCall() 56 49 (_Py_MakeRecCheck(PyThreadState_GET()->recursion_depth) && \ 50 _Py_CheckRecursiveCall(where)) 51 #define Py_LeaveRecursiveCall() \ 52 (--PyThreadState_GET()->recursion_depth) 57 53 PyAPI_FUNC(int) _Py_CheckRecursiveCall(char *where); 58 54 PyAPI_DATA(int) _Py_CheckRecursionLimit; … … 80 76 threads to run as follows: 81 77 82 83 84 85 86 78 ...preparations here... 79 Py_BEGIN_ALLOW_THREADS 80 ...blocking system call here... 81 Py_END_ALLOW_THREADS 82 ...interpret result here... 87 83 88 84 The Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS pair expands to a … … 91 87 a line containing Py_BLOCK_THREADS before the return, e.g. 92 88 93 94 95 96 97 89 if (...premature_exit...) { 90 Py_BLOCK_THREADS 91 PyErr_SetFromErrno(PyExc_IOError); 92 return NULL; 93 } 98 94 99 95 An alternative is: 100 96 101 102 103 104 105 106 97 Py_BLOCK_THREADS 98 if (...premature_exit...) { 99 PyErr_SetFromErrno(PyExc_IOError); 100 return NULL; 101 } 102 Py_UNBLOCK_THREADS 107 103 108 104 For convenience, that the value of 'errno' is restored across … … 133 129 134 130 #define Py_BEGIN_ALLOW_THREADS { \ 135 136 137 #define Py_BLOCK_THREADS 138 #define Py_UNBLOCK_THREADS 139 #define Py_END_ALLOW_THREADS 140 131 PyThreadState *_save; \ 132 _save = PyEval_SaveThread(); 133 #define Py_BLOCK_THREADS PyEval_RestoreThread(_save); 134 #define Py_UNBLOCK_THREADS _save = PyEval_SaveThread(); 135 #define Py_END_ALLOW_THREADS PyEval_RestoreThread(_save); \ 136 } 141 137 142 138 #else /* !WITH_THREAD */ -
python/vendor/current/Include/classobject.h
r2 r388 19 19 PyObject *cl_setattr; 20 20 PyObject *cl_delattr; 21 PyObject *cl_weakreflist; /* List of weak references */ 21 22 } PyClassObject; 22 23 -
python/vendor/current/Include/cobject.h
r2 r388 1 /* 2 CObjects are marked Pending Deprecation as of Python 2.7. 3 The full schedule for 2.x is as follows: 4 - CObjects are marked Pending Deprecation in Python 2.7. 5 - CObjects will be marked Deprecated in Python 2.8 6 (if there is one). 7 - CObjects will be removed in Python 2.9 (if there is one). 8 9 Additionally, for the Python 3.x series: 10 - CObjects were marked Deprecated in Python 3.1. 11 - CObjects will be removed in Python 3.2. 12 13 You should switch all use of CObjects to capsules. Capsules 14 have a safer and more consistent API. For more information, 15 see Include/pycapsule.h, or read the "Capsules" topic in 16 the "Python/C API Reference Manual". 17 18 Python 2.7 no longer uses CObjects itself; all objects which 19 were formerly CObjects are now capsules. Note that this change 20 does not by itself break binary compatibility with extensions 21 built for previous versions of Python--PyCObject_AsVoidPtr() 22 has been changed to also understand capsules. 23 24 */ 25 26 /* original file header comment follows: */ 1 27 2 28 /* C objects to be exported from one extension module to another. -
python/vendor/current/Include/code.h
r2 r388 24 24 PyObject *co_name; /* string (name, for reference) */ 25 25 int co_firstlineno; /* first source line number */ 26 PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) */ 26 PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) See 27 Objects/lnotab_notes.txt for details. */ 27 28 void *co_zombieframe; /* for optimization only (see frameobject.c) */ 29 PyObject *co_weakreflist; /* to support weakrefs to code objects */ 28 30 } PyCodeObject; 29 31 … … 71 73 PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *); 72 74 /* same as struct above */ 75 76 /* Creates a new empty code object with the specified source location. */ 77 PyAPI_FUNC(PyCodeObject *) 78 PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno); 79 80 /* Return the line number associated with the specified bytecode index 81 in this code object. If you just need the line number of a frame, 82 use PyFrame_GetLineNumber() instead. */ 73 83 PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int); 74 84 … … 83 93 } PyAddrPair; 84 94 85 /* Check whether lasti (an instruction offset) falls outside bounds 86 and whether it is a line number that should be traced. Returns 87 a line number if it should be traced or -1 if the line should not. 88 89 If lasti is not within bounds, updates bounds. 95 /* Update *bounds to describe the first and one-past-the-last instructions in the 96 same line as lasti. Return the number of that line. 90 97 */ 91 92 PyAPI_FUNC(int) PyCode_CheckLineNumber(PyCodeObject* co, 93 int lasti, PyAddrPair *bounds); 98 PyAPI_FUNC(int) _PyCode_CheckLineNumber(PyCodeObject* co, 99 int lasti, PyAddrPair *bounds); 94 100 95 101 PyAPI_FUNC(PyObject*) PyCode_Optimize(PyObject *code, PyObject* consts, -
python/vendor/current/Include/codecs.h
r2 r388 134 134 /* Unicode encoding error handling callback registry API */ 135 135 136 /* Register the error handling callback function error under the name136 /* Register the error handling callback function error under the given 137 137 name. This function will be called by the codec when it encounters 138 138 unencodable characters/undecodable bytes and doesn't know the … … 142 142 PyAPI_FUNC(int) PyCodec_RegisterError(const char *name, PyObject *error); 143 143 144 /* Lookup the error handling callback function registered under the 145 name error. As a special case NULL can be passed, in which case144 /* Lookup the error handling callback function registered under the given 145 name. As a special case NULL can be passed, in which case 146 146 the error handling callback for "strict" will be returned. */ 147 147 PyAPI_FUNC(PyObject *) PyCodec_LookupError(const char *name); … … 153 153 PyAPI_FUNC(PyObject *) PyCodec_IgnoreErrors(PyObject *exc); 154 154 155 /* replace the unicode e rror with ? or U+FFFD */155 /* replace the unicode encode error with ? or U+FFFD */ 156 156 PyAPI_FUNC(PyObject *) PyCodec_ReplaceErrors(PyObject *exc); 157 157 -
python/vendor/current/Include/compile.h
r2 r388 34 34 PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *); 35 35 36 #define ERR_LATE_FUTURE \37 "from __future__ imports must occur at the beginning of the file"38 36 39 37 #ifdef __cplusplus -
python/vendor/current/Include/complexobject.h
r2 r388 55 55 PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op); 56 56 57 /* Format the object based on the format_spec, as defined in PEP 3101 58 (Advanced String Formatting). */ 59 PyAPI_FUNC(PyObject *) _PyComplex_FormatAdvanced(PyObject *obj, 60 char *format_spec, 61 Py_ssize_t format_spec_len); 62 57 63 #ifdef __cplusplus 58 64 } -
python/vendor/current/Include/datetime.h
r2 r388 12 12 * 13 13 * byte offset 14 * 0 15 * 2 16 * 3 17 * 4 18 * 5 19 * 6 20 * 7 14 * 0 year 2 bytes, 1-9999 15 * 2 month 1 byte, 1-12 16 * 3 day 1 byte, 1-31 17 * 4 hour 1 byte, 0-23 18 * 5 minute 1 byte, 0-59 19 * 6 second 1 byte, 0-59 20 * 7 usecond 3 bytes, 0-999999 21 21 * 10 22 22 */ … … 34 34 typedef struct 35 35 { 36 37 long hashcode;/* -1 when unknown */38 int days;/* -MAX_DELTA_DAYS <= days <= MAX_DELTA_DAYS */39 int seconds;/* 0 <= seconds < 24*3600 is invariant */40 int microseconds;/* 0 <= microseconds < 1000000 is invariant */36 PyObject_HEAD 37 long hashcode; /* -1 when unknown */ 38 int days; /* -MAX_DELTA_DAYS <= days <= MAX_DELTA_DAYS */ 39 int seconds; /* 0 <= seconds < 24*3600 is invariant */ 40 int microseconds; /* 0 <= microseconds < 1000000 is invariant */ 41 41 } PyDateTime_Delta; 42 42 43 43 typedef struct 44 44 { 45 PyObject_HEAD /* a pure abstract base clase*/45 PyObject_HEAD /* a pure abstract base class */ 46 46 } PyDateTime_TZInfo; 47 47 … … 50 50 * present if and only if hastzinfo is true. 51 51 */ 52 #define _PyTZINFO_HEAD 53 PyObject_HEAD\54 long hashcode;\55 char hastzinfo;/* boolean flag */52 #define _PyTZINFO_HEAD \ 53 PyObject_HEAD \ 54 long hashcode; \ 55 char hastzinfo; /* boolean flag */ 56 56 57 57 /* No _PyDateTime_BaseTZInfo is allocated; it's just to have something … … 61 61 typedef struct 62 62 { 63 63 _PyTZINFO_HEAD 64 64 } _PyDateTime_BaseTZInfo; 65 65 … … 70 70 * "without" case. 71 71 */ 72 #define _PyDateTime_TIMEHEAD 73 _PyTZINFO_HEAD\74 75 76 typedef struct 77 { 78 79 } _PyDateTime_BaseTime; 80 81 typedef struct 82 { 83 84 85 } PyDateTime_Time; 72 #define _PyDateTime_TIMEHEAD \ 73 _PyTZINFO_HEAD \ 74 unsigned char data[_PyDateTime_TIME_DATASIZE]; 75 76 typedef struct 77 { 78 _PyDateTime_TIMEHEAD 79 } _PyDateTime_BaseTime; /* hastzinfo false */ 80 81 typedef struct 82 { 83 _PyDateTime_TIMEHEAD 84 PyObject *tzinfo; 85 } PyDateTime_Time; /* hastzinfo true */ 86 86 87 87 … … 93 93 typedef struct 94 94 { 95 96 95 _PyTZINFO_HEAD 96 unsigned char data[_PyDateTime_DATE_DATASIZE]; 97 97 } PyDateTime_Date; 98 98 99 #define _PyDateTime_DATETIMEHEAD 100 _PyTZINFO_HEAD\101 102 103 typedef struct 104 { 105 106 } _PyDateTime_BaseDateTime; 107 108 typedef struct 109 { 110 111 112 } PyDateTime_DateTime; 99 #define _PyDateTime_DATETIMEHEAD \ 100 _PyTZINFO_HEAD \ 101 unsigned char data[_PyDateTime_DATETIME_DATASIZE]; 102 103 typedef struct 104 { 105 _PyDateTime_DATETIMEHEAD 106 } _PyDateTime_BaseDateTime; /* hastzinfo false */ 107 108 typedef struct 109 { 110 _PyDateTime_DATETIMEHEAD 111 PyObject *tzinfo; 112 } PyDateTime_DateTime; /* hastzinfo true */ 113 113 114 114 115 115 /* Apply for date and datetime instances. */ 116 116 #define PyDateTime_GET_YEAR(o) ((((PyDateTime_Date*)o)->data[0] << 8) | \ 117 117 ((PyDateTime_Date*)o)->data[1]) 118 118 #define PyDateTime_GET_MONTH(o) (((PyDateTime_Date*)o)->data[2]) 119 119 #define PyDateTime_GET_DAY(o) (((PyDateTime_Date*)o)->data[3]) … … 122 122 #define PyDateTime_DATE_GET_MINUTE(o) (((PyDateTime_DateTime*)o)->data[5]) 123 123 #define PyDateTime_DATE_GET_SECOND(o) (((PyDateTime_DateTime*)o)->data[6]) 124 #define PyDateTime_DATE_GET_MICROSECOND(o) 125 ((((PyDateTime_DateTime*)o)->data[7] << 16) |\126 (((PyDateTime_DateTime*)o)->data[8] << 8) |\127 124 #define PyDateTime_DATE_GET_MICROSECOND(o) \ 125 ((((PyDateTime_DateTime*)o)->data[7] << 16) | \ 126 (((PyDateTime_DateTime*)o)->data[8] << 8) | \ 127 ((PyDateTime_DateTime*)o)->data[9]) 128 128 129 129 /* Apply for time instances. */ … … 131 131 #define PyDateTime_TIME_GET_MINUTE(o) (((PyDateTime_Time*)o)->data[1]) 132 132 #define PyDateTime_TIME_GET_SECOND(o) (((PyDateTime_Time*)o)->data[2]) 133 #define PyDateTime_TIME_GET_MICROSECOND(o) 134 ((((PyDateTime_Time*)o)->data[3] << 16) |\135 (((PyDateTime_Time*)o)->data[4] << 8) |\136 133 #define PyDateTime_TIME_GET_MICROSECOND(o) \ 134 ((((PyDateTime_Time*)o)->data[3] << 16) | \ 135 (((PyDateTime_Time*)o)->data[4] << 8) | \ 136 ((PyDateTime_Time*)o)->data[5]) 137 137 138 138 … … 149 149 PyObject *(*Date_FromDate)(int, int, int, PyTypeObject*); 150 150 PyObject *(*DateTime_FromDateAndTime)(int, int, int, int, int, int, int, 151 151 PyObject*, PyTypeObject*); 152 152 PyObject *(*Time_FromTime)(int, int, int, int, PyObject*, PyTypeObject*); 153 153 PyObject *(*Delta_FromDelta)(int, int, int, int, PyTypeObject*); … … 159 159 } PyDateTime_CAPI; 160 160 161 #define PyDateTime_CAPSULE_NAME "datetime.datetime_CAPI" 162 161 163 162 164 /* "magic" constant used to partially protect against developer mistakes. */ … … 184 186 185 187 /* Define global variable for the C API and a macro for setting it. */ 186 static PyDateTime_CAPI *PyDateTimeAPI ;188 static PyDateTime_CAPI *PyDateTimeAPI = NULL; 187 189 188 190 #define PyDateTime_IMPORT \ 189 PyDateTimeAPI = (PyDateTime_CAPI*) PyCObject_Import("datetime", \ 190 "datetime_CAPI") 191 192 /* This macro would be used if PyCObject_ImportEx() was created. 193 #define PyDateTime_IMPORT \ 194 PyDateTimeAPI = (PyDateTime_CAPI*) PyCObject_ImportEx("datetime", \ 195 "datetime_CAPI", \ 196 DATETIME_API_MAGIC) 197 */ 191 PyDateTimeAPI = (PyDateTime_CAPI *)PyCapsule_Import(PyDateTime_CAPSULE_NAME, 0) 198 192 199 193 /* Macros for type checking when not building the Python core. */ … … 215 209 /* Macros for accessing constructors in a simplified fashion. */ 216 210 #define PyDate_FromDate(year, month, day) \ 217 211 PyDateTimeAPI->Date_FromDate(year, month, day, PyDateTimeAPI->DateType) 218 212 219 213 #define PyDateTime_FromDateAndTime(year, month, day, hour, min, sec, usec) \ 220 221 214 PyDateTimeAPI->DateTime_FromDateAndTime(year, month, day, hour, \ 215 min, sec, usec, Py_None, PyDateTimeAPI->DateTimeType) 222 216 223 217 #define PyTime_FromTime(hour, minute, second, usecond) \ 224 225 218 PyDateTimeAPI->Time_FromTime(hour, minute, second, usecond, \ 219 Py_None, PyDateTimeAPI->TimeType) 226 220 227 221 #define PyDelta_FromDSU(days, seconds, useconds) \ 228 229 222 PyDateTimeAPI->Delta_FromDelta(days, seconds, useconds, 1, \ 223 PyDateTimeAPI->DeltaType) 230 224 231 225 /* Macros supporting the DB API. */ 232 226 #define PyDateTime_FromTimestamp(args) \ 233 234 227 PyDateTimeAPI->DateTime_FromTimestamp( \ 228 (PyObject*) (PyDateTimeAPI->DateTimeType), args, NULL) 235 229 236 230 #define PyDate_FromTimestamp(args) \ 237 238 239 240 #endif 231 PyDateTimeAPI->Date_FromTimestamp( \ 232 (PyObject*) (PyDateTimeAPI->DateType), args) 233 234 #endif /* Py_BUILD_CORE */ 241 235 242 236 #ifdef __cplusplus -
python/vendor/current/Include/descrobject.h
r2 r388 10 10 11 11 typedef struct PyGetSetDef { 12 13 14 15 16 12 char *name; 13 getter get; 14 setter set; 15 char *doc; 16 void *closure; 17 17 } PyGetSetDef; 18 18 19 19 typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args, 20 20 void *wrapped); 21 21 22 22 typedef PyObject *(*wrapperfunc_kwds)(PyObject *self, PyObject *args, 23 23 void *wrapped, PyObject *kwds); 24 24 25 25 struct wrapperbase { 26 27 28 29 30 31 32 26 char *name; 27 int offset; 28 void *function; 29 wrapperfunc wrapper; 30 char *doc; 31 int flags; 32 PyObject *name_strobj; 33 33 }; 34 34 … … 39 39 40 40 #define PyDescr_COMMON \ 41 42 43 41 PyObject_HEAD \ 42 PyTypeObject *d_type; \ 43 PyObject *d_name 44 44 45 45 typedef struct { 46 46 PyDescr_COMMON; 47 47 } PyDescrObject; 48 48 49 49 typedef struct { 50 51 50 PyDescr_COMMON; 51 PyMethodDef *d_method; 52 52 } PyMethodDescrObject; 53 53 54 54 typedef struct { 55 56 55 PyDescr_COMMON; 56 struct PyMemberDef *d_member; 57 57 } PyMemberDescrObject; 58 58 59 59 typedef struct { 60 61 60 PyDescr_COMMON; 61 PyGetSetDef *d_getset; 62 62 } PyGetSetDescrObject; 63 63 64 64 typedef struct { 65 66 67 65 PyDescr_COMMON; 66 struct wrapperbase *d_base; 67 void *d_wrapped; /* This can be any function pointer */ 68 68 } PyWrapperDescrObject; 69 69 … … 76 76 PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *); 77 77 PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *, 78 78 struct PyMemberDef *); 79 79 PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *, 80 80 struct PyGetSetDef *); 81 81 PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *, 82 82 struct wrapperbase *, void *); 83 83 #define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL) 84 84 -
python/vendor/current/Include/dictobject.h
r2 r388 49 49 50 50 typedef struct { 51 52 53 54 55 56 57 51 /* Cached hash code of me_key. Note that hash codes are C longs. 52 * We have to use Py_ssize_t instead because dict_popitem() abuses 53 * me_hash to hold a search finger. 54 */ 55 Py_ssize_t me_hash; 56 PyObject *me_key; 57 PyObject *me_value; 58 58 } PyDictEntry; 59 59 … … 69 69 typedef struct _dictobject PyDictObject; 70 70 struct _dictobject { 71 72 73 71 PyObject_HEAD 72 Py_ssize_t ma_fill; /* # Active + # Dummy */ 73 Py_ssize_t ma_used; /* # Active */ 74 74 75 76 77 78 79 75 /* The table contains ma_mask + 1 slots, and that's a power of 2. 76 * We store the mask instead of the size because the mask is more 77 * frequently needed. 78 */ 79 Py_ssize_t ma_mask; 80 80 81 82 83 84 85 86 87 88 81 /* ma_table points to ma_smalltable for small tables, else to 82 * additional malloc'ed memory. ma_table is never NULL! This rule 83 * saves repeated runtime null-tests in the workhorse getitem and 84 * setitem calls. 85 */ 86 PyDictEntry *ma_table; 87 PyDictEntry *(*ma_lookup)(PyDictObject *mp, PyObject *key, long hash); 88 PyDictEntry ma_smalltable[PyDict_MINSIZE]; 89 89 }; 90 90 91 91 PyAPI_DATA(PyTypeObject) PyDict_Type; 92 PyAPI_DATA(PyTypeObject) PyDictIterKey_Type; 93 PyAPI_DATA(PyTypeObject) PyDictIterValue_Type; 94 PyAPI_DATA(PyTypeObject) PyDictIterItem_Type; 95 PyAPI_DATA(PyTypeObject) PyDictKeys_Type; 96 PyAPI_DATA(PyTypeObject) PyDictItems_Type; 97 PyAPI_DATA(PyTypeObject) PyDictValues_Type; 92 98 93 99 #define PyDict_Check(op) \ 94 100 PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS) 95 101 #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) 102 #define PyDictKeys_Check(op) (Py_TYPE(op) == &PyDictKeys_Type) 103 #define PyDictItems_Check(op) (Py_TYPE(op) == &PyDictItems_Type) 104 #define PyDictValues_Check(op) (Py_TYPE(op) == &PyDictValues_Type) 105 /* This excludes Values, since they are not sets. */ 106 # define PyDictViewSet_Check(op) \ 107 (PyDictKeys_Check(op) || PyDictItems_Check(op)) 96 108 97 109 PyAPI_FUNC(PyObject *) PyDict_New(void); … … 101 113 PyAPI_FUNC(void) PyDict_Clear(PyObject *mp); 102 114 PyAPI_FUNC(int) PyDict_Next( 103 115 PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value); 104 116 PyAPI_FUNC(int) _PyDict_Next( 105 117 PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, long *hash); 106 118 PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp); 107 119 PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp); … … 112 124 PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, long hash); 113 125 PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused); 126 PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp); 114 127 115 128 /* PyDict_Update(mp, other) is equivalent to PyDict_Merge(mp, other, 1). */ … … 122 135 */ 123 136 PyAPI_FUNC(int) PyDict_Merge(PyObject *mp, 124 125 137 PyObject *other, 138 int override); 126 139 127 140 /* PyDict_MergeFromSeq2 updates/merges from an iterable object producing … … 131 144 */ 132 145 PyAPI_FUNC(int) PyDict_MergeFromSeq2(PyObject *d, 133 134 146 PyObject *seq2, 147 int override); 135 148 136 149 PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, const char *key); -
python/vendor/current/Include/fileobject.h
r2 r388 9 9 10 10 typedef struct { 11 12 13 14 15 16 int f_softspace;/* Flag used by 'print' command */17 int f_binary; /* Flag which indicates whether the file is 18 19 char* f_buf;/* Allocated readahead buffer */20 char* f_bufend;/* Points after last occupied position */21 char* f_bufptr;/* Current buffer position */22 char *f_setbuf;/* Buffer for setbuf(3) and setvbuf(3) */23 int f_univ_newline;/* Handle any newline convention */24 int f_newlinetypes;/* Types of newlines seen */25 int f_skipnextlf;/* Skip next \n */26 27 28 29 int unlocked_count;/* Num. currently running sections of code30 31 32 11 PyObject_HEAD 12 FILE *f_fp; 13 PyObject *f_name; 14 PyObject *f_mode; 15 int (*f_close)(FILE *); 16 int f_softspace; /* Flag used by 'print' command */ 17 int f_binary; /* Flag which indicates whether the file is 18 open in binary (1) or text (0) mode */ 19 char* f_buf; /* Allocated readahead buffer */ 20 char* f_bufend; /* Points after last occupied position */ 21 char* f_bufptr; /* Current buffer position */ 22 char *f_setbuf; /* Buffer for setbuf(3) and setvbuf(3) */ 23 int f_univ_newline; /* Handle any newline convention */ 24 int f_newlinetypes; /* Types of newlines seen */ 25 int f_skipnextlf; /* Skip next \n */ 26 PyObject *f_encoding; 27 PyObject *f_errors; 28 PyObject *weakreflist; /* List of weak references */ 29 int unlocked_count; /* Num. currently running sections of code 30 using f_fp with the GIL released. */ 31 int readable; 32 int writable; 33 33 } PyFileObject; 34 34 … … 71 71 int _PyFile_SanitizeMode(char *mode); 72 72 73 #if defined _MSC_VER && _MSC_VER >= 1400 74 /* A routine to check if a file descriptor is valid on Windows. Returns 0 75 * and sets errno to EBADF if it isn't. This is to avoid Assertions 76 * from various functions in the Windows CRT beginning with 77 * Visual Studio 2005 78 */ 79 int _PyVerify_fd(int fd); 80 #elif defined _MSC_VER && _MSC_VER >= 1200 81 /* fdopen doesn't set errno EBADF and crashes for large fd on debug build */ 82 #define _PyVerify_fd(fd) (_get_osfhandle(fd) >= 0) 83 #else 84 #define _PyVerify_fd(A) (1) /* dummy */ 85 #endif 86 87 /* A routine to check if a file descriptor can be select()-ed. */ 88 #ifdef HAVE_SELECT 89 #define _PyIsSelectable_fd(FD) (((FD) >= 0) && ((FD) < FD_SETSIZE)) 90 #else 91 #define _PyIsSelectable_fd(FD) (1) 92 #endif /* HAVE_SELECT */ 93 73 94 #ifdef __cplusplus 74 95 } -
python/vendor/current/Include/floatobject.h
r2 r388 21 21 #define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type) 22 22 #define PyFloat_CheckExact(op) (Py_TYPE(op) == &PyFloat_Type) 23 24 /* The str() precision PyFloat_STR_PRECISION is chosen so that in most cases, 25 the rounding noise created by various operations is suppressed, while 26 giving plenty of precision for practical use. */ 27 28 #define PyFloat_STR_PRECISION 12 23 29 24 30 #ifdef Py_NAN … … 122 128 Py_ssize_t format_spec_len); 123 129 130 /* Round a C double x to the closest multiple of 10**-ndigits. Returns a 131 Python float on success, or NULL (with an appropriate exception set) on 132 failure. Used in builtin_round in bltinmodule.c. */ 133 PyAPI_FUNC(PyObject *) _Py_double_round(double x, int ndigits); 134 135 136 124 137 #ifdef __cplusplus 125 138 } -
python/vendor/current/Include/frameobject.h
r2 r388 39 39 PyThreadState *f_tstate; 40 40 int f_lasti; /* Last instruction if called */ 41 /* As of 2.3 f_lineno is only valid when tracing is active (i.e. when 42 f_trace is set) -- at other times use PyCode_Addr2Line instead. */ 41 /* Call PyFrame_GetLineNumber() instead of reading this field 42 directly. As of 2.3 f_lineno is only valid when tracing is 43 active (i.e. when f_trace is set). At other times we use 44 PyCode_Addr2Line to calculate the line from the current 45 bytecode index. */ 43 46 int f_lineno; /* Current line number */ 44 47 int f_iblock; /* index in f_blockstack */ … … 78 81 PyAPI_FUNC(int) PyFrame_ClearFreeList(void); 79 82 83 /* Return the line of code the frame is currently executing. */ 84 PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject *); 85 80 86 #ifdef __cplusplus 81 87 } -
python/vendor/current/Include/graminit.h
r2 r388 43 43 #define try_stmt 296 44 44 #define with_stmt 297 45 #define with_ var29845 #define with_item 298 46 46 #define except_clause 299 47 47 #define suite 300 … … 65 65 #define atom 318 66 66 #define listmaker 319 67 #define testlist_ gexp 32067 #define testlist_comp 320 68 68 #define lambdef 321 69 69 #define trailer 322 … … 73 73 #define exprlist 326 74 74 #define testlist 327 75 #define dict maker 32875 #define dictorsetmaker 328 76 76 #define classdef 329 77 77 #define arglist 330 … … 80 80 #define list_for 333 81 81 #define list_if 334 82 #define gen_iter 33583 #define gen_for 33684 #define gen_if 33782 #define comp_iter 335 83 #define comp_for 336 84 #define comp_if 337 85 85 #define testlist1 338 86 86 #define encoding_decl 339 -
python/vendor/current/Include/import.h
r2 r388 52 52 PyAPI_DATA(struct _inittab *) PyImport_Inittab; 53 53 54 PyAPI_FUNC(int) PyImport_AppendInittab(c har *name, void (*initfunc)(void));54 PyAPI_FUNC(int) PyImport_AppendInittab(const char *name, void (*initfunc)(void)); 55 55 PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab); 56 56 -
python/vendor/current/Include/intobject.h
r2 r388 41 41 PyAPI_FUNC(long) PyInt_AsLong(PyObject *); 42 42 PyAPI_FUNC(Py_ssize_t) PyInt_AsSsize_t(PyObject *); 43 PyAPI_FUNC(int) _PyInt_AsInt(PyObject *); 43 44 PyAPI_FUNC(unsigned long) PyInt_AsUnsignedLongMask(PyObject *); 44 45 #ifdef HAVE_LONG_LONG -
python/vendor/current/Include/longintrepr.h
r2 r388 8 8 /* This is published for the benefit of "friend" marshal.c only. */ 9 9 10 /* Parameters of the long integer representation. 11 These shouldn't have to be changed as C should guarantee that a short 12 contains at least 16 bits, but it's made changeable anyway. 13 Note: 'digit' should be able to hold 2*MASK+1, and 'twodigits' 14 should be able to hold the intermediate results in 'mul' 15 (at most (BASE-1)*(2*BASE+1) == MASK*(2*MASK+3)). 16 Also, x_sub assumes that 'digit' is an unsigned type, and overflow 17 is handled by taking the result mod 2**N for some N > SHIFT. 18 And, at some places it is assumed that MASK fits in an int, as well. 19 long_pow() requires that SHIFT be divisible by 5. */ 10 /* Parameters of the long integer representation. There are two different 11 sets of parameters: one set for 30-bit digits, stored in an unsigned 32-bit 12 integer type, and one set for 15-bit digits with each digit stored in an 13 unsigned short. The value of PYLONG_BITS_IN_DIGIT, defined either at 14 configure time or in pyport.h, is used to decide which digit size to use. 20 15 16 Type 'digit' should be able to hold 2*PyLong_BASE-1, and type 'twodigits' 17 should be an unsigned integer type able to hold all integers up to 18 PyLong_BASE*PyLong_BASE-1. x_sub assumes that 'digit' is an unsigned type, 19 and that overflow is handled by taking the result modulo 2**N for some N > 20 PyLong_SHIFT. The majority of the code doesn't care about the precise 21 value of PyLong_SHIFT, but there are some notable exceptions: 22 23 - long_pow() requires that PyLong_SHIFT be divisible by 5 24 25 - PyLong_{As,From}ByteArray require that PyLong_SHIFT be at least 8 26 27 - long_hash() requires that PyLong_SHIFT is *strictly* less than the number 28 of bits in an unsigned long, as do the PyLong <-> long (or unsigned long) 29 conversion functions 30 31 - the long <-> size_t/Py_ssize_t conversion functions expect that 32 PyLong_SHIFT is strictly less than the number of bits in a size_t 33 34 - the marshal code currently expects that PyLong_SHIFT is a multiple of 15 35 36 The values 15 and 30 should fit all of the above requirements, on any 37 platform. 38 */ 39 40 #if PYLONG_BITS_IN_DIGIT == 30 41 #if !(defined HAVE_UINT64_T && defined HAVE_UINT32_T && \ 42 defined HAVE_INT64_T && defined HAVE_INT32_T) 43 #error "30-bit long digits requested, but the necessary types are not available on this platform" 44 #endif 45 typedef PY_UINT32_T digit; 46 typedef PY_INT32_T sdigit; /* signed variant of digit */ 47 typedef PY_UINT64_T twodigits; 48 typedef PY_INT64_T stwodigits; /* signed variant of twodigits */ 49 #define PyLong_SHIFT 30 50 #define _PyLong_DECIMAL_SHIFT 9 /* max(e such that 10**e fits in a digit) */ 51 #define _PyLong_DECIMAL_BASE ((digit)1000000000) /* 10 ** DECIMAL_SHIFT */ 52 #elif PYLONG_BITS_IN_DIGIT == 15 21 53 typedef unsigned short digit; 22 typedef unsigned int wdigit; /* digit widened to parameter size */ 23 #define BASE_TWODIGITS_TYPE long 24 typedef unsigned BASE_TWODIGITS_TYPE twodigits; 25 typedef BASE_TWODIGITS_TYPE stwodigits; /* signed variant of twodigits */ 26 27 #define PyLong_SHIFT 15 28 #define PyLong_BASE ((digit)1 << PyLong_SHIFT) 29 #define PyLong_MASK ((int)(PyLong_BASE - 1)) 54 typedef short sdigit; /* signed variant of digit */ 55 typedef unsigned long twodigits; 56 typedef long stwodigits; /* signed variant of twodigits */ 57 #define PyLong_SHIFT 15 58 #define _PyLong_DECIMAL_SHIFT 4 /* max(e such that 10**e fits in a digit) */ 59 #define _PyLong_DECIMAL_BASE ((digit)10000) /* 10 ** DECIMAL_SHIFT */ 60 #else 61 #error "PYLONG_BITS_IN_DIGIT should be 15 or 30" 62 #endif 63 #define PyLong_BASE ((digit)1 << PyLong_SHIFT) 64 #define PyLong_MASK ((digit)(PyLong_BASE - 1)) 30 65 31 66 /* b/w compatibility with Python 2.5 */ -
python/vendor/current/Include/longobject.h
r2 r388 22 22 PyAPI_FUNC(PyObject *) PyLong_FromSsize_t(Py_ssize_t); 23 23 PyAPI_FUNC(long) PyLong_AsLong(PyObject *); 24 PyAPI_FUNC(long) PyLong_AsLongAndOverflow(PyObject *, int *); 24 25 PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLong(PyObject *); 25 26 PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLongMask(PyObject *); 26 27 PyAPI_FUNC(Py_ssize_t) PyLong_AsSsize_t(PyObject *); 28 PyAPI_FUNC(int) _PyLong_AsInt(PyObject *); 29 PyAPI_FUNC(PyObject *) PyLong_GetInfo(void); 27 30 28 31 /* For use by intobject.c only */ … … 32 35 PyAPI_DATA(int) _PyLong_DigitValue[256]; 33 36 34 /* _PyLong_ AsScaledDouble returns a double x and an exponent e such that35 t he true value is approximately equal to x * 2**(SHIFT*e). e is >= 0.36 x is0.0 if and only if the input is 0 (in which case, e and x are both37 zeroes) . Overflow is impossible. Note that the exponent returned must38 be multiplied by SHIFT! There may not be enough room in an int to store39 e*SHIFT directly. */40 PyAPI_FUNC(double) _PyLong_ AsScaledDouble(PyObject *vv, int *e);37 /* _PyLong_Frexp returns a double x and an exponent e such that the 38 true value is approximately equal to x * 2**e. e is >= 0. x is 39 0.0 if and only if the input is 0 (in which case, e and x are both 40 zeroes); otherwise, 0.5 <= abs(x) < 1.0. On overflow, which is 41 possible if the number of bits doesn't fit into a Py_ssize_t, sets 42 OverflowError and returns -1.0 for x, 0 for e. */ 43 PyAPI_FUNC(double) _PyLong_Frexp(PyLongObject *a, Py_ssize_t *e); 41 44 42 45 PyAPI_FUNC(double) PyLong_AsDouble(PyObject *); … … 50 53 PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *); 51 54 PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *); 55 PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLongAndOverflow(PyObject *, int *); 52 56 #endif /* HAVE_LONG_LONG */ 53 57 -
python/vendor/current/Include/node.h
r2 r388 21 21 char *str, int lineno, int col_offset); 22 22 PyAPI_FUNC(void) PyNode_Free(node *n); 23 #ifndef Py_LIMITED_API 24 Py_ssize_t _PyNode_SizeOf(node *n); 25 #endif 23 26 24 27 /* Node access functions */ -
python/vendor/current/Include/object.h
r2 r388 64 64 #ifdef Py_TRACE_REFS 65 65 /* Define pointers to support a doubly-linked list of all live heap objects. */ 66 #define _PyObject_HEAD_EXTRA 67 struct _object *_ob_next;\68 66 #define _PyObject_HEAD_EXTRA \ 67 struct _object *_ob_next; \ 68 struct _object *_ob_prev; 69 69 70 70 #define _PyObject_EXTRA_INIT 0, 0, … … 76 76 77 77 /* PyObject_HEAD defines the initial segment of every PyObject. */ 78 #define PyObject_HEAD 79 _PyObject_HEAD_EXTRA\80 Py_ssize_t ob_refcnt;\81 82 83 #define PyObject_HEAD_INIT(type) 84 _PyObject_EXTRA_INIT\85 86 87 #define PyVarObject_HEAD_INIT(type, size) 88 78 #define PyObject_HEAD \ 79 _PyObject_HEAD_EXTRA \ 80 Py_ssize_t ob_refcnt; \ 81 struct _typeobject *ob_type; 82 83 #define PyObject_HEAD_INIT(type) \ 84 _PyObject_EXTRA_INIT \ 85 1, type, 86 87 #define PyVarObject_HEAD_INIT(type, size) \ 88 PyObject_HEAD_INIT(type) size, 89 89 90 90 /* PyObject_VAR_HEAD defines the initial segment of all variable-size … … 94 94 * not necessarily a byte count. 95 95 */ 96 #define PyObject_VAR_HEAD 97 PyObject_HEAD\98 96 #define PyObject_VAR_HEAD \ 97 PyObject_HEAD \ 98 Py_ssize_t ob_size; /* Number of items in variable part */ 99 99 #define Py_INVALID_SIZE (Py_ssize_t)-1 100 100 … … 105 105 */ 106 106 typedef struct _object { 107 107 PyObject_HEAD 108 108 } PyObject; 109 109 110 110 typedef struct { 111 111 PyObject_VAR_HEAD 112 112 } PyVarObject; 113 113 114 #define Py_REFCNT(ob) 115 #define Py_TYPE(ob) 116 #define Py_SIZE(ob) 114 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) 115 #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) 116 #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) 117 117 118 118 /* … … 160 160 typedef Py_ssize_t (*charbufferproc)(PyObject *, Py_ssize_t, char **); 161 161 162 162 163 /* Py3k buffer interface */ 163 164 164 typedef struct bufferinfo { 165 void *buf; 166 PyObject *obj; /* borrowed reference */ 167 Py_ssize_t len; 168 Py_ssize_t itemsize; /* This is Py_ssize_t so it can be 169 pointed to by strides in simple case.*/ 170 int readonly; 171 int ndim; 172 char *format; 173 Py_ssize_t *shape; 174 Py_ssize_t *strides; 175 Py_ssize_t *suboffsets; 176 void *internal; 165 void *buf; 166 PyObject *obj; /* owned reference */ 167 Py_ssize_t len; 168 Py_ssize_t itemsize; /* This is Py_ssize_t so it can be 169 pointed to by strides in simple case.*/ 170 int readonly; 171 int ndim; 172 char *format; 173 Py_ssize_t *shape; 174 Py_ssize_t *strides; 175 Py_ssize_t *suboffsets; 176 Py_ssize_t smalltable[2]; /* static store for shape and strides of 177 mono-dimensional buffers. */ 178 void *internal; 177 179 } Py_buffer; 178 180 … … 180 182 typedef void (*releasebufferproc)(PyObject *, Py_buffer *); 181 183 182 184 /* Flags for getting buffers */ 183 185 #define PyBUF_SIMPLE 0 184 186 #define PyBUF_WRITABLE 0x0001 … … 216 218 217 219 typedef struct { 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 220 /* For numbers without flag bit Py_TPFLAGS_CHECKTYPES set, all 221 arguments are guaranteed to be of the object's type (modulo 222 coercion hacks -- i.e. if the type's coercion function 223 returns other types, then these are allowed as well). Numbers that 224 have the Py_TPFLAGS_CHECKTYPES flag bit set should check *both* 225 arguments for proper type and implement the necessary conversions 226 in the slot functions themselves. */ 227 228 binaryfunc nb_add; 229 binaryfunc nb_subtract; 230 binaryfunc nb_multiply; 231 binaryfunc nb_divide; 232 binaryfunc nb_remainder; 233 binaryfunc nb_divmod; 234 ternaryfunc nb_power; 235 unaryfunc nb_negative; 236 unaryfunc nb_positive; 237 unaryfunc nb_absolute; 238 inquiry nb_nonzero; 239 unaryfunc nb_invert; 240 binaryfunc nb_lshift; 241 binaryfunc nb_rshift; 242 binaryfunc nb_and; 243 binaryfunc nb_xor; 244 binaryfunc nb_or; 245 coercion nb_coerce; 246 unaryfunc nb_int; 247 unaryfunc nb_long; 248 unaryfunc nb_float; 249 unaryfunc nb_oct; 250 unaryfunc nb_hex; 251 /* Added in release 2.0 */ 252 binaryfunc nb_inplace_add; 253 binaryfunc nb_inplace_subtract; 254 binaryfunc nb_inplace_multiply; 255 binaryfunc nb_inplace_divide; 256 binaryfunc nb_inplace_remainder; 257 ternaryfunc nb_inplace_power; 258 binaryfunc nb_inplace_lshift; 259 binaryfunc nb_inplace_rshift; 260 binaryfunc nb_inplace_and; 261 binaryfunc nb_inplace_xor; 262 binaryfunc nb_inplace_or; 263 264 /* Added in release 2.2 */ 265 /* The following require the Py_TPFLAGS_HAVE_CLASS flag */ 266 binaryfunc nb_floor_divide; 267 binaryfunc nb_true_divide; 268 binaryfunc nb_inplace_floor_divide; 269 binaryfunc nb_inplace_true_divide; 270 271 /* Added in release 2.5 */ 272 unaryfunc nb_index; 271 273 } PyNumberMethods; 272 274 273 275 typedef struct { 274 275 276 277 278 279 280 281 282 283 284 276 lenfunc sq_length; 277 binaryfunc sq_concat; 278 ssizeargfunc sq_repeat; 279 ssizeargfunc sq_item; 280 ssizessizeargfunc sq_slice; 281 ssizeobjargproc sq_ass_item; 282 ssizessizeobjargproc sq_ass_slice; 283 objobjproc sq_contains; 284 /* Added in release 2.0 */ 285 binaryfunc sq_inplace_concat; 286 ssizeargfunc sq_inplace_repeat; 285 287 } PySequenceMethods; 286 288 287 289 typedef struct { 288 289 290 290 lenfunc mp_length; 291 binaryfunc mp_subscript; 292 objobjargproc mp_ass_subscript; 291 293 } PyMappingMethods; 292 294 293 295 typedef struct { 294 295 296 297 298 299 296 readbufferproc bf_getreadbuffer; 297 writebufferproc bf_getwritebuffer; 298 segcountproc bf_getsegcount; 299 charbufferproc bf_getcharbuffer; 300 getbufferproc bf_getbuffer; 301 releasebufferproc bf_releasebuffer; 300 302 } PyBufferProcs; 301 303 … … 321 323 322 324 typedef struct _typeobject { 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 325 PyObject_VAR_HEAD 326 const char *tp_name; /* For printing, in format "<module>.<name>" */ 327 Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */ 328 329 /* Methods to implement standard operations */ 330 331 destructor tp_dealloc; 332 printfunc tp_print; 333 getattrfunc tp_getattr; 334 setattrfunc tp_setattr; 335 cmpfunc tp_compare; 336 reprfunc tp_repr; 337 338 /* Method suites for standard classes */ 339 340 PyNumberMethods *tp_as_number; 341 PySequenceMethods *tp_as_sequence; 342 PyMappingMethods *tp_as_mapping; 343 344 /* More standard operations (here for binary compatibility) */ 345 346 hashfunc tp_hash; 347 ternaryfunc tp_call; 348 reprfunc tp_str; 349 getattrofunc tp_getattro; 350 setattrofunc tp_setattro; 351 352 /* Functions to access object as input/output buffer */ 353 PyBufferProcs *tp_as_buffer; 354 355 /* Flags to define presence of optional/expanded features */ 356 long tp_flags; 357 358 const char *tp_doc; /* Documentation string */ 359 360 /* Assigned meaning in release 2.0 */ 361 /* call function for all accessible objects */ 362 traverseproc tp_traverse; 363 364 /* delete references to contained objects */ 365 inquiry tp_clear; 366 367 /* Assigned meaning in release 2.1 */ 368 /* rich comparisons */ 369 richcmpfunc tp_richcompare; 370 371 /* weak reference enabler */ 372 Py_ssize_t tp_weaklistoffset; 373 374 /* Added in release 2.2 */ 375 /* Iterators */ 376 getiterfunc tp_iter; 377 iternextfunc tp_iternext; 378 379 /* Attribute descriptor and subclassing stuff */ 380 struct PyMethodDef *tp_methods; 381 struct PyMemberDef *tp_members; 382 struct PyGetSetDef *tp_getset; 383 struct _typeobject *tp_base; 384 PyObject *tp_dict; 385 descrgetfunc tp_descr_get; 386 descrsetfunc tp_descr_set; 387 Py_ssize_t tp_dictoffset; 388 initproc tp_init; 389 allocfunc tp_alloc; 390 newfunc tp_new; 391 freefunc tp_free; /* Low-level free-memory routine */ 392 inquiry tp_is_gc; /* For PyObject_IS_GC */ 393 PyObject *tp_bases; 394 PyObject *tp_mro; /* method resolution order */ 395 PyObject *tp_cache; 396 PyObject *tp_subclasses; 397 PyObject *tp_weaklist; 398 destructor tp_del; 399 400 /* Type attribute cache version tag. Added in version 2.6 */ 401 unsigned int tp_version_tag; 400 402 401 403 #ifdef COUNT_ALLOCS 402 403 404 405 406 407 404 /* these must be last and never explicitly initialized */ 405 Py_ssize_t tp_allocs; 406 Py_ssize_t tp_frees; 407 Py_ssize_t tp_maxalloc; 408 struct _typeobject *tp_prev; 409 struct _typeobject *tp_next; 408 410 #endif 409 411 } PyTypeObject; … … 412 414 /* The *real* layout of a type object when allocated on the heap */ 413 415 typedef struct _heaptypeobject { 414 415 416 417 418 419 420 421 422 423 424 425 426 416 /* Note: there's a dependency on the order of these members 417 in slotptr() in typeobject.c . */ 418 PyTypeObject ht_type; 419 PyNumberMethods as_number; 420 PyMappingMethods as_mapping; 421 PySequenceMethods as_sequence; /* as_sequence comes after as_mapping, 422 so that the mapping wins when both 423 the mapping and the sequence define 424 a given operator (e.g. __getitem__). 425 see add_operators() in typeobject.c . */ 426 PyBufferProcs as_buffer; 427 PyObject *ht_name, *ht_slots; 428 /* here are optional user slots, followed by the members. */ 427 429 } PyHeapTypeObject; 428 430 … … 435 437 PyAPI_FUNC(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *); 436 438 #define PyObject_TypeCheck(ob, tp) \ 437 439 (Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp))) 438 440 439 441 PyAPI_DATA(PyTypeObject) PyType_Type; /* built-in 'type' */ … … 442 444 443 445 #define PyType_Check(op) \ 444 446 PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TYPE_SUBCLASS) 445 447 #define PyType_CheckExact(op) (Py_TYPE(op) == &PyType_Type) 446 448 … … 448 450 PyAPI_FUNC(PyObject *) PyType_GenericAlloc(PyTypeObject *, Py_ssize_t); 449 451 PyAPI_FUNC(PyObject *) PyType_GenericNew(PyTypeObject *, 450 452 PyObject *, PyObject *); 451 453 PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *); 454 PyAPI_FUNC(PyObject *) _PyObject_LookupSpecial(PyObject *, char *, PyObject **); 452 455 PyAPI_FUNC(unsigned int) PyType_ClearCache(void); 453 456 PyAPI_FUNC(void) PyType_Modified(PyTypeObject *); … … 474 477 PyAPI_FUNC(PyObject **) _PyObject_GetDictPtr(PyObject *); 475 478 PyAPI_FUNC(PyObject *) PyObject_SelfIter(PyObject *); 479 PyAPI_FUNC(PyObject *) _PyObject_NextNotImplemented(PyObject *); 476 480 PyAPI_FUNC(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *); 477 481 PyAPI_FUNC(int) PyObject_GenericSetAttr(PyObject *, 478 482 PyObject *, PyObject *); 479 483 PyAPI_FUNC(long) PyObject_Hash(PyObject *); 480 484 PyAPI_FUNC(long) PyObject_HashNotImplemented(PyObject *); … … 489 493 /* A slot function whose address we need to compare */ 490 494 extern int _PyObject_SlotCompare(PyObject *, PyObject *); 495 /* Same as PyObject_Generic{Get,Set}Attr, but passing the attributes 496 dict as the last parameter. */ 497 PyAPI_FUNC(PyObject *) 498 _PyObject_GenericGetAttrWithDict(PyObject *, PyObject *, PyObject *); 499 PyAPI_FUNC(int) 500 _PyObject_GenericSetAttrWithDict(PyObject *, PyObject *, 501 PyObject *, PyObject *); 491 502 492 503 … … 507 518 PyAPI_FUNC(long) _Py_HashPointer(void*); 508 519 520 typedef struct { 521 long prefix; 522 long suffix; 523 } _Py_HashSecret_t; 524 PyAPI_DATA(_Py_HashSecret_t) _Py_HashSecret; 525 526 #ifdef Py_DEBUG 527 PyAPI_DATA(int) _Py_HashSecret_Initialized; 528 #endif 529 509 530 /* Helper for passing objects to printf and the like */ 510 531 #define PyObject_REPR(obj) PyString_AS_STRING(PyObject_Repr(obj)) 511 532 512 533 /* Flag bits for printing: */ 513 #define Py_PRINT_RAW 1/* No string quotes etc. */534 #define Py_PRINT_RAW 1 /* No string quotes etc. */ 514 535 515 536 /* … … 604 625 605 626 /* These flags are used to determine if a type is a subclass. */ 606 #define Py_TPFLAGS_INT_SUBCLASS 607 #define Py_TPFLAGS_LONG_SUBCLASS 608 #define Py_TPFLAGS_LIST_SUBCLASS 609 #define Py_TPFLAGS_TUPLE_SUBCLASS 610 #define Py_TPFLAGS_STRING_SUBCLASS 611 #define Py_TPFLAGS_UNICODE_SUBCLASS 612 #define Py_TPFLAGS_DICT_SUBCLASS 613 #define Py_TPFLAGS_BASE_EXC_SUBCLASS 614 #define Py_TPFLAGS_TYPE_SUBCLASS 627 #define Py_TPFLAGS_INT_SUBCLASS (1L<<23) 628 #define Py_TPFLAGS_LONG_SUBCLASS (1L<<24) 629 #define Py_TPFLAGS_LIST_SUBCLASS (1L<<25) 630 #define Py_TPFLAGS_TUPLE_SUBCLASS (1L<<26) 631 #define Py_TPFLAGS_STRING_SUBCLASS (1L<<27) 632 #define Py_TPFLAGS_UNICODE_SUBCLASS (1L<<28) 633 #define Py_TPFLAGS_DICT_SUBCLASS (1L<<29) 634 #define Py_TPFLAGS_BASE_EXC_SUBCLASS (1L<<30) 635 #define Py_TPFLAGS_TYPE_SUBCLASS (1L<<31) 615 636 616 637 #define Py_TPFLAGS_DEFAULT_EXTERNAL ( \ 617 618 619 620 621 622 623 624 625 626 638 Py_TPFLAGS_HAVE_GETCHARBUFFER | \ 639 Py_TPFLAGS_HAVE_SEQUENCE_IN | \ 640 Py_TPFLAGS_HAVE_INPLACEOPS | \ 641 Py_TPFLAGS_HAVE_RICHCOMPARE | \ 642 Py_TPFLAGS_HAVE_WEAKREFS | \ 643 Py_TPFLAGS_HAVE_ITER | \ 644 Py_TPFLAGS_HAVE_CLASS | \ 645 Py_TPFLAGS_HAVE_STACKLESS_EXTENSION | \ 646 Py_TPFLAGS_HAVE_INDEX | \ 647 0) 627 648 #define Py_TPFLAGS_DEFAULT_CORE (Py_TPFLAGS_DEFAULT_EXTERNAL | \ 628 649 Py_TPFLAGS_HAVE_VERSION_TAG) 629 650 630 651 #ifdef Py_BUILD_CORE … … 684 705 PyAPI_DATA(Py_ssize_t) _Py_RefTotal; 685 706 PyAPI_FUNC(void) _Py_NegativeRefcount(const char *fname, 686 707 int lineno, PyObject *op); 687 708 PyAPI_FUNC(PyObject *) _PyDict_Dummy(void); 688 709 PyAPI_FUNC(PyObject *) _PySet_Dummy(void); 689 710 PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void); 690 #define _Py_INC_REFTOTAL 691 #define _Py_DEC_REFTOTAL 692 #define _Py_REF_DEBUG_COMMA 693 #define _Py_CHECK_REFCNT(OP) 694 { if (((PyObject*)OP)->ob_refcnt < 0)\695 _Py_NegativeRefcount(__FILE__, __LINE__,\696 (PyObject *)(OP));\711 #define _Py_INC_REFTOTAL _Py_RefTotal++ 712 #define _Py_DEC_REFTOTAL _Py_RefTotal-- 713 #define _Py_REF_DEBUG_COMMA , 714 #define _Py_CHECK_REFCNT(OP) \ 715 { if (((PyObject*)OP)->ob_refcnt < 0) \ 716 _Py_NegativeRefcount(__FILE__, __LINE__, \ 717 (PyObject *)(OP)); \ 697 718 } 698 719 #else … … 700 721 #define _Py_DEC_REFTOTAL 701 722 #define _Py_REF_DEBUG_COMMA 702 #define _Py_CHECK_REFCNT(OP) 723 #define _Py_CHECK_REFCNT(OP) /* a semicolon */; 703 724 #endif /* Py_REF_DEBUG */ 704 725 … … 706 727 PyAPI_FUNC(void) inc_count(PyTypeObject *); 707 728 PyAPI_FUNC(void) dec_count(PyTypeObject *); 708 #define _Py_INC_TPALLOCS(OP) 709 #define _Py_INC_TPFREES(OP) 710 #define _Py_DEC_TPFREES(OP) 711 #define _Py_COUNT_ALLOCS_COMMA 729 #define _Py_INC_TPALLOCS(OP) inc_count(Py_TYPE(OP)) 730 #define _Py_INC_TPFREES(OP) dec_count(Py_TYPE(OP)) 731 #define _Py_DEC_TPFREES(OP) Py_TYPE(OP)->tp_frees-- 732 #define _Py_COUNT_ALLOCS_COMMA , 712 733 #else 713 734 #define _Py_INC_TPALLOCS(OP) … … 730 751 * inline. 731 752 */ 732 #define _Py_NewReference(op) ( 733 _Py_INC_TPALLOCS(op) _Py_COUNT_ALLOCS_COMMA\734 _Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA\735 753 #define _Py_NewReference(op) ( \ 754 _Py_INC_TPALLOCS(op) _Py_COUNT_ALLOCS_COMMA \ 755 _Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA \ 756 Py_REFCNT(op) = 1) 736 757 737 758 #define _Py_ForgetReference(op) _Py_INC_TPFREES(op) 738 759 739 #define _Py_Dealloc(op) ( 740 _Py_INC_TPFREES(op) _Py_COUNT_ALLOCS_COMMA\741 760 #define _Py_Dealloc(op) ( \ 761 _Py_INC_TPFREES(op) _Py_COUNT_ALLOCS_COMMA \ 762 (*Py_TYPE(op)->tp_dealloc)((PyObject *)(op))) 742 763 #endif /* !Py_TRACE_REFS */ 743 764 744 #define Py_INCREF(op) ( \ 745 _Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA \ 746 ((PyObject*)(op))->ob_refcnt++) 747 748 #define Py_DECREF(op) \ 749 if (_Py_DEC_REFTOTAL _Py_REF_DEBUG_COMMA \ 750 --((PyObject*)(op))->ob_refcnt != 0) \ 751 _Py_CHECK_REFCNT(op) \ 752 else \ 753 _Py_Dealloc((PyObject *)(op)) 765 #define Py_INCREF(op) ( \ 766 _Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA \ 767 ((PyObject*)(op))->ob_refcnt++) 768 769 #define Py_DECREF(op) \ 770 do { \ 771 if (_Py_DEC_REFTOTAL _Py_REF_DEBUG_COMMA \ 772 --((PyObject*)(op))->ob_refcnt != 0) \ 773 _Py_CHECK_REFCNT(op) \ 774 else \ 775 _Py_Dealloc((PyObject *)(op)); \ 776 } while (0) 754 777 755 778 /* Safely decref `op` and set `op` to NULL, especially useful in tp_clear … … 787 810 * to use Py_CLEAR() even if you can't think of a reason for why you need to. 788 811 */ 789 #define Py_CLEAR(op) 790 do {\791 if (op) {\792 PyObject *_py_tmp = (PyObject *)(op);\793 (op) = NULL;\794 Py_DECREF(_py_tmp);\795 }\796 812 #define Py_CLEAR(op) \ 813 do { \ 814 if (op) { \ 815 PyObject *_py_tmp = (PyObject *)(op); \ 816 (op) = NULL; \ 817 Py_DECREF(_py_tmp); \ 818 } \ 819 } while (0) 797 820 798 821 /* Macros to use in case the object pointer may be NULL: */ 799 #define Py_XINCREF(op) if ((op) == NULL) ; else Py_INCREF(op)800 #define Py_XDECREF(op) if ((op) == NULL) ; else Py_DECREF(op)822 #define Py_XINCREF(op) do { if ((op) == NULL) ; else Py_INCREF(op); } while (0) 823 #define Py_XDECREF(op) do { if ((op) == NULL) ; else Py_DECREF(op); } while (0) 801 824 802 825 /* … … 921 944 mytype_dealloc(mytype *p) 922 945 { 923 924 925 PyObject_GC_UnTrack(p);// must untrack first926 927 928 929 946 ... declarations go here ... 947 948 PyObject_GC_UnTrack(p); // must untrack first 949 Py_TRASHCAN_SAFE_BEGIN(p) 950 ... The body of the deallocator goes here, including all calls ... 951 ... to Py_DECREF on contained objects. ... 952 Py_TRASHCAN_SAFE_END(p) 930 953 } 931 954 … … 949 972 */ 950 973 974 /* This is the old private API, invoked by the macros before 2.7.4. 975 Kept for binary compatibility of extensions. */ 951 976 PyAPI_FUNC(void) _PyTrash_deposit_object(PyObject*); 952 977 PyAPI_FUNC(void) _PyTrash_destroy_chain(void); … … 954 979 PyAPI_DATA(PyObject *) _PyTrash_delete_later; 955 980 981 /* The new thread-safe private API, invoked by the macros below. */ 982 PyAPI_FUNC(void) _PyTrash_thread_deposit_object(PyObject*); 983 PyAPI_FUNC(void) _PyTrash_thread_destroy_chain(void); 984 956 985 #define PyTrash_UNWIND_LEVEL 50 957 986 987 /* Note the workaround for when the thread state is NULL (issue #17703) */ 958 988 #define Py_TRASHCAN_SAFE_BEGIN(op) \ 959 if (_PyTrash_delete_nesting < PyTrash_UNWIND_LEVEL) { \ 960 ++_PyTrash_delete_nesting; 961 /* The body of the deallocator is here. */ 989 do { \ 990 PyThreadState *_tstate = PyThreadState_GET(); \ 991 if (!_tstate || \ 992 _tstate->trash_delete_nesting < PyTrash_UNWIND_LEVEL) { \ 993 if (_tstate) \ 994 ++_tstate->trash_delete_nesting; 995 /* The body of the deallocator is here. */ 962 996 #define Py_TRASHCAN_SAFE_END(op) \ 963 --_PyTrash_delete_nesting; \ 964 if (_PyTrash_delete_later && _PyTrash_delete_nesting <= 0) \ 965 _PyTrash_destroy_chain(); \ 966 } \ 967 else \ 968 _PyTrash_deposit_object((PyObject*)op); 997 if (_tstate) { \ 998 --_tstate->trash_delete_nesting; \ 999 if (_tstate->trash_delete_later \ 1000 && _tstate->trash_delete_nesting <= 0) \ 1001 _PyTrash_thread_destroy_chain(); \ 1002 } \ 1003 } \ 1004 else \ 1005 _PyTrash_thread_deposit_object((PyObject*)op); \ 1006 } while (0); 969 1007 970 1008 #ifdef __cplusplus -
python/vendor/current/Include/objimpl.h
r2 r388 102 102 /* Macros */ 103 103 #ifdef WITH_PYMALLOC 104 #ifdef PYMALLOC_DEBUG 104 #ifdef PYMALLOC_DEBUG /* WITH_PYMALLOC && PYMALLOC_DEBUG */ 105 105 PyAPI_FUNC(void *) _PyObject_DebugMalloc(size_t nbytes); 106 106 PyAPI_FUNC(void *) _PyObject_DebugRealloc(void *p, size_t nbytes); … … 109 109 PyAPI_FUNC(void) _PyObject_DebugCheckAddress(const void *p); 110 110 PyAPI_FUNC(void) _PyObject_DebugMallocStats(void); 111 #define PyObject_MALLOC _PyObject_DebugMalloc 112 #define PyObject_Malloc _PyObject_DebugMalloc 113 #define PyObject_REALLOC _PyObject_DebugRealloc 114 #define PyObject_Realloc _PyObject_DebugRealloc 115 #define PyObject_FREE _PyObject_DebugFree 116 #define PyObject_Free _PyObject_DebugFree 117 118 #else /* WITH_PYMALLOC && ! PYMALLOC_DEBUG */ 119 #define PyObject_MALLOC PyObject_Malloc 120 #define PyObject_REALLOC PyObject_Realloc 121 #define PyObject_FREE PyObject_Free 111 PyAPI_FUNC(void *) _PyObject_DebugMallocApi(char api, size_t nbytes); 112 PyAPI_FUNC(void *) _PyObject_DebugReallocApi(char api, void *p, size_t nbytes); 113 PyAPI_FUNC(void) _PyObject_DebugFreeApi(char api, void *p); 114 PyAPI_FUNC(void) _PyObject_DebugCheckAddressApi(char api, const void *p); 115 PyAPI_FUNC(void *) _PyMem_DebugMalloc(size_t nbytes); 116 PyAPI_FUNC(void *) _PyMem_DebugRealloc(void *p, size_t nbytes); 117 PyAPI_FUNC(void) _PyMem_DebugFree(void *p); 118 #define PyObject_MALLOC _PyObject_DebugMalloc 119 #define PyObject_Malloc _PyObject_DebugMalloc 120 #define PyObject_REALLOC _PyObject_DebugRealloc 121 #define PyObject_Realloc _PyObject_DebugRealloc 122 #define PyObject_FREE _PyObject_DebugFree 123 #define PyObject_Free _PyObject_DebugFree 124 125 #else /* WITH_PYMALLOC && ! PYMALLOC_DEBUG */ 126 #define PyObject_MALLOC PyObject_Malloc 127 #define PyObject_REALLOC PyObject_Realloc 128 #define PyObject_FREE PyObject_Free 122 129 #endif 123 130 124 #else 125 #define PyObject_MALLOC 126 #define PyObject_REALLOC 127 #define PyObject_FREE 128 129 #endif 130 131 #define PyObject_Del 132 #define PyObject_DEL 131 #else /* ! WITH_PYMALLOC */ 132 #define PyObject_MALLOC PyMem_MALLOC 133 #define PyObject_REALLOC PyMem_REALLOC 134 #define PyObject_FREE PyMem_FREE 135 136 #endif /* WITH_PYMALLOC */ 137 138 #define PyObject_Del PyObject_Free 139 #define PyObject_DEL PyObject_FREE 133 140 134 141 /* for source compatibility with 2.2 */ 135 #define _PyObject_Del 142 #define _PyObject_Del PyObject_Free 136 143 137 144 /* … … 148 155 149 156 #define PyObject_New(type, typeobj) \ 150 157 ( (type *) _PyObject_New(typeobj) ) 151 158 #define PyObject_NewVar(type, typeobj, n) \ 152 159 ( (type *) _PyObject_NewVar((typeobj), (n)) ) 153 160 154 161 /* Macros trading binary compatibility for speed. See also pymem.h. 155 162 Note that these macros expect non-NULL object pointers.*/ 156 163 #define PyObject_INIT(op, typeobj) \ 157 164 ( Py_TYPE(op) = (typeobj), _Py_NewReference((PyObject *)(op)), (op) ) 158 165 #define PyObject_INIT_VAR(op, typeobj, size) \ 159 166 ( Py_SIZE(op) = (size), PyObject_INIT((op), (typeobj)) ) 160 167 161 168 #define _PyObject_SIZE(typeobj) ( (typeobj)->tp_basicsize ) … … 175 182 #endif 176 183 177 #define _PyObject_VAR_SIZE(typeobj, nitems) 178 (size_t)\179 ( ( (typeobj)->tp_basicsize +\180 (nitems)*(typeobj)->tp_itemsize +\181 (SIZEOF_VOID_P - 1)\182 ) & ~(SIZEOF_VOID_P - 1)\183 184 #define _PyObject_VAR_SIZE(typeobj, nitems) \ 185 (size_t) \ 186 ( ( (typeobj)->tp_basicsize + \ 187 (nitems)*(typeobj)->tp_itemsize + \ 188 (SIZEOF_VOID_P - 1) \ 189 ) & ~(SIZEOF_VOID_P - 1) \ 190 ) 184 191 185 192 #define PyObject_NEW(type, typeobj) \ 186 193 ( (type *) PyObject_Init( \ 187 194 (PyObject *) PyObject_MALLOC( _PyObject_SIZE(typeobj) ), (typeobj)) ) 188 195 189 196 #define PyObject_NEW_VAR(type, typeobj, n) \ … … 197 204 1) the actual allocation of the object storage; 198 205 2) the initialization of the Python specific fields 199 206 in this storage with PyObject_{Init, InitVar}. 200 207 201 208 PyObject * … … 206 213 op = (PyObject *) Your_Allocator(_PyObject_SIZE(YourTypeStruct)); 207 214 if (op == NULL) 208 215 return PyErr_NoMemory(); 209 216 210 217 PyObject_Init(op, &YourTypeStruct); … … 233 240 /* Test if an object has a GC head */ 234 241 #define PyObject_IS_GC(o) (PyType_IS_GC(Py_TYPE(o)) && \ 235 242 (Py_TYPE(o)->tp_is_gc == NULL || Py_TYPE(o)->tp_is_gc(o))) 236 243 237 244 PyAPI_FUNC(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, Py_ssize_t); 238 245 #define PyObject_GC_Resize(type, op, n) \ 239 246 ( (type *) _PyObject_GC_Resize((PyVarObject *)(op), (n)) ) 240 247 241 248 /* for source compatibility with 2.2 */ … … 244 251 /* GC information is stored BEFORE the object structure. */ 245 252 typedef union _gc_head { 246 247 248 249 250 251 253 struct { 254 union _gc_head *gc_next; 255 union _gc_head *gc_prev; 256 Py_ssize_t gc_refs; 257 } gc; 258 long double dummy; /* force worst-case alignment */ 252 259 } PyGC_Head; 253 260 … … 256 263 #define _Py_AS_GC(o) ((PyGC_Head *)(o)-1) 257 264 258 #define _PyGC_REFS_UNTRACKED 259 #define _PyGC_REFS_REACHABLE 260 #define _PyGC_REFS_TENTATIVELY_UNREACHABLE 265 #define _PyGC_REFS_UNTRACKED (-2) 266 #define _PyGC_REFS_REACHABLE (-3) 267 #define _PyGC_REFS_TENTATIVELY_UNREACHABLE (-4) 261 268 262 269 /* Tell the GC to track this object. NB: While the object is tracked the 263 270 * collector it must be safe to call the ob_traverse method. */ 264 271 #define _PyObject_GC_TRACK(o) do { \ 265 266 267 268 269 270 271 272 272 PyGC_Head *g = _Py_AS_GC(o); \ 273 if (g->gc.gc_refs != _PyGC_REFS_UNTRACKED) \ 274 Py_FatalError("GC object already tracked"); \ 275 g->gc.gc_refs = _PyGC_REFS_REACHABLE; \ 276 g->gc.gc_next = _PyGC_generation0; \ 277 g->gc.gc_prev = _PyGC_generation0->gc.gc_prev; \ 278 g->gc.gc_prev->gc.gc_next = g; \ 279 _PyGC_generation0->gc.gc_prev = g; \ 273 280 } while (0); 274 281 … … 278 285 */ 279 286 #define _PyObject_GC_UNTRACK(o) do { \ 280 281 282 283 284 285 287 PyGC_Head *g = _Py_AS_GC(o); \ 288 assert(g->gc.gc_refs != _PyGC_REFS_UNTRACKED); \ 289 g->gc.gc_refs = _PyGC_REFS_UNTRACKED; \ 290 g->gc.gc_prev->gc.gc_next = g->gc.gc_next; \ 291 g->gc.gc_next->gc.gc_prev = g->gc.gc_prev; \ 292 g->gc.gc_next = NULL; \ 286 293 } while (0); 294 295 /* True if the object is currently tracked by the GC. */ 296 #define _PyObject_GC_IS_TRACKED(o) \ 297 ((_Py_AS_GC(o))->gc.gc_refs != _PyGC_REFS_UNTRACKED) 298 299 /* True if the object may be tracked by the GC in the future, or already is. 300 This can be useful to implement some optimizations. */ 301 #define _PyObject_GC_MAY_BE_TRACKED(obj) \ 302 (PyObject_IS_GC(obj) && \ 303 (!PyTuple_CheckExact(obj) || _PyObject_GC_IS_TRACKED(obj))) 304 287 305 288 306 PyAPI_FUNC(PyObject *) _PyObject_GC_Malloc(size_t); … … 294 312 295 313 #define PyObject_GC_New(type, typeobj) \ 296 314 ( (type *) _PyObject_GC_New(typeobj) ) 297 315 #define PyObject_GC_NewVar(type, typeobj, n) \ 298 316 ( (type *) _PyObject_GC_NewVar((typeobj), (n)) ) 299 317 300 318 … … 304 322 * looking as much alike as possible. 305 323 */ 306 #define Py_VISIT(op) 307 do {\308 if (op) {\309 int vret = visit((PyObject *)(op), arg);\310 if (vret)\311 return vret;\312 }\313 324 #define Py_VISIT(op) \ 325 do { \ 326 if (op) { \ 327 int vret = visit((PyObject *)(op), arg); \ 328 if (vret) \ 329 return vret; \ 330 } \ 331 } while (0) 314 332 315 333 /* This is here for the sake of backwards compatibility. Extensions that … … 325 343 /* Test if a type supports weak references */ 326 344 #define PyType_SUPPORTS_WEAKREFS(t) \ 327 328 345 (PyType_HasFeature((t), Py_TPFLAGS_HAVE_WEAKREFS) \ 346 && ((t)->tp_weaklistoffset > 0)) 329 347 330 348 #define PyObject_GET_WEAKREFS_LISTPTR(o) \ 331 349 ((PyObject **) (((char *) (o)) + Py_TYPE(o)->tp_weaklistoffset)) 332 350 333 351 #ifdef __cplusplus -
python/vendor/current/Include/opcode.h
r2 r388 23 23 #define UNARY_INVERT 15 24 24 25 #define LIST_APPEND 1826 25 #define BINARY_POWER 19 27 26 … … 90 89 #define UNPACK_SEQUENCE 92 /* Number of sequence items */ 91 90 #define FOR_ITER 93 91 #define LIST_APPEND 94 92 92 93 93 #define STORE_ATTR 95 /* Index in name list */ … … 100 100 #define BUILD_TUPLE 102 /* Number of tuple items */ 101 101 #define BUILD_LIST 103 /* Number of list items */ 102 #define BUILD_MAP 104 /* Always zero for now */ 103 #define LOAD_ATTR 105 /* Index in name list */ 104 #define COMPARE_OP 106 /* Comparison operator */ 105 #define IMPORT_NAME 107 /* Index in name list */ 106 #define IMPORT_FROM 108 /* Index in name list */ 102 #define BUILD_SET 104 /* Number of set items */ 103 #define BUILD_MAP 105 /* Always zero for now */ 104 #define LOAD_ATTR 106 /* Index in name list */ 105 #define COMPARE_OP 107 /* Comparison operator */ 106 #define IMPORT_NAME 108 /* Index in name list */ 107 #define IMPORT_FROM 109 /* Index in name list */ 108 #define JUMP_FORWARD 110 /* Number of bytes to skip */ 107 109 108 #define JUMP_FORWARD 110 /* Number of bytes to skip */ 109 #define JUMP_IF_FALSE 111 /* "" */ 110 #define JUMP_IF_TRUE 112 /* "" */ 111 #define JUMP_ABSOLUTE 113 /* Target byte offset from beginning of code */ 110 #define JUMP_IF_FALSE_OR_POP 111 /* Target byte offset from beginning 111 of code */ 112 #define JUMP_IF_TRUE_OR_POP 112 /* "" */ 113 #define JUMP_ABSOLUTE 113 /* "" */ 114 #define POP_JUMP_IF_FALSE 114 /* "" */ 115 #define POP_JUMP_IF_TRUE 115 /* "" */ 112 116 113 117 #define LOAD_GLOBAL 116 /* Index in name list */ … … 139 143 #define CALL_FUNCTION_VAR_KW 142 /* #args + (#kwargs<<8) */ 140 144 145 #define SETUP_WITH 143 146 141 147 /* Support for opargs more than 16 bits long */ 142 #define EXTENDED_ARG 143 148 #define EXTENDED_ARG 145 149 150 #define SET_ADD 146 151 #define MAP_ADD 147 143 152 144 153 -
python/vendor/current/Include/osdefs.h
r2 r388 37 37 38 38 /* Max pathname length */ 39 #ifdef __hpux 40 #include <sys/param.h> 41 #include <limits.h> 42 #ifndef PATH_MAX 43 #define PATH_MAX MAXPATHLEN 44 #endif 45 #endif 46 39 47 #ifndef MAXPATHLEN 40 48 #if defined(PATH_MAX) && PATH_MAX > 1024 -
python/vendor/current/Include/patchlevel.h
r2 r388 7 7 8 8 When the major or minor version changes, the VERSION variable in 9 configure. inmust also be changed.9 configure.ac must also be changed. 10 10 11 11 There is also (independent) API version information in modsupport.h. … … 22 22 /*--start constants--*/ 23 23 #define PY_MAJOR_VERSION 2 24 #define PY_MINOR_VERSION 625 #define PY_MICRO_VERSION 524 #define PY_MINOR_VERSION 7 25 #define PY_MICRO_VERSION 6 26 26 #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL 27 27 #define PY_RELEASE_SERIAL 0 28 28 29 29 /* Version as a string */ 30 #define PY_VERSION "2. 6.5"30 #define PY_VERSION "2.7.6" 31 31 /*--end constants--*/ 32 32 33 /* Subversion Revision number of this file (not of the repository) */ 34 #define PY_PATCHLEVEL_REVISION "$Revision: 79063 $" 33 /* Subversion Revision number of this file (not of the repository). Empty 34 since Mercurial migration. */ 35 #define PY_PATCHLEVEL_REVISION "" 35 36 36 37 /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. -
python/vendor/current/Include/py_curses.h
r2 r388 81 81 #define PyCursesWindow_Check(v) (Py_TYPE(v) == &PyCursesWindow_Type) 82 82 83 #define PyCurses_CAPSULE_NAME "_curses._C_API" 84 85 83 86 #ifdef CURSES_MODULE 84 87 /* This section is used when compiling _cursesmodule.c */ … … 95 98 96 99 #define import_curses() \ 97 { \ 98 PyObject *module = PyImport_ImportModuleNoBlock("_curses"); \ 99 if (module != NULL) { \ 100 PyObject *module_dict = PyModule_GetDict(module); \ 101 PyObject *c_api_object = PyDict_GetItemString(module_dict, "_C_API"); \ 102 if (PyCObject_Check(c_api_object)) { \ 103 PyCurses_API = (void **)PyCObject_AsVoidPtr(c_api_object); \ 104 } \ 105 } \ 106 } 100 PyCurses_API = (void **)PyCapsule_Import(PyCurses_CAPSULE_NAME, 1); 101 107 102 #endif 108 103 -
python/vendor/current/Include/pydebug.h
r2 r388 27 27 /* Warn about 3.x issues */ 28 28 PyAPI_DATA(int) Py_Py3kWarningFlag; 29 PyAPI_DATA(int) Py_HashRandomizationFlag; 29 30 30 31 /* this is a wrapper around getenv() that pays attention to -
python/vendor/current/Include/pyerrors.h
r2 r388 95 95 /* */ 96 96 97 #define PyExceptionClass_Check(x) 98 (PyClass_Check((x)) || (PyType_Check((x)) &&\99 100 101 #define PyExceptionInstance_Check(x) 102 (PyInstance_Check((x)) ||\103 104 105 #define PyExceptionClass_Name(x) 106 (PyClass_Check((x))\107 ? PyString_AS_STRING(((PyClassObject*)(x))->cl_name)\108 109 110 #define PyExceptionInstance_Class(x) 111 ((PyInstance_Check((x))\112 ? (PyObject*)((PyInstanceObject*)(x))->in_class\113 114 115 97 #define PyExceptionClass_Check(x) \ 98 (PyClass_Check((x)) || (PyType_Check((x)) && \ 99 PyType_FastSubclass((PyTypeObject*)(x), Py_TPFLAGS_BASE_EXC_SUBCLASS))) 100 101 #define PyExceptionInstance_Check(x) \ 102 (PyInstance_Check((x)) || \ 103 PyType_FastSubclass((x)->ob_type, Py_TPFLAGS_BASE_EXC_SUBCLASS)) 104 105 #define PyExceptionClass_Name(x) \ 106 (PyClass_Check((x)) \ 107 ? PyString_AS_STRING(((PyClassObject*)(x))->cl_name) \ 108 : (char *)(((PyTypeObject*)(x))->tp_name)) 109 110 #define PyExceptionInstance_Class(x) \ 111 ((PyInstance_Check((x)) \ 112 ? (PyObject*)((PyInstanceObject*)(x))->in_class \ 113 : (PyObject*)((x)->ob_type))) 114 115 116 116 /* Predefined exceptions */ 117 117 … … 185 185 PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *); 186 186 PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject( 187 PyObject *, PyObject *); 188 PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(PyObject *, char *); 189 #ifdef Py_WIN_WIDE_FILENAMES 187 PyObject *, PyObject *); 188 PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename( 189 PyObject *, const char *); 190 #ifdef MS_WINDOWS 190 191 PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename( 191 PyObject *,Py_UNICODE *);192 #endif /* Py_WIN_WIDE_FILENAMES */192 PyObject *, const Py_UNICODE *); 193 #endif /* MS_WINDOWS */ 193 194 194 195 PyAPI_FUNC(PyObject *) PyErr_Format(PyObject *, const char *, ...) 195 196 Py_GCC_ATTRIBUTE((format(printf, 2, 3))); 196 197 197 198 #ifdef MS_WINDOWS 198 199 PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilenameObject( 199 200 int, const char *); 200 201 PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename( 201 int, const char *); 202 #ifdef Py_WIN_WIDE_FILENAMES 202 int, const char *); 203 203 PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename( 204 int, const Py_UNICODE *); 205 #endif /* Py_WIN_WIDE_FILENAMES */ 204 int, const Py_UNICODE *); 206 205 PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int); 207 206 PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject( 208 207 PyObject *,int, PyObject *); 209 208 PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename( 210 PyObject *,int, const char *); 211 #ifdef Py_WIN_WIDE_FILENAMES 209 PyObject *,int, const char *); 212 210 PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename( 213 PyObject *,int, const Py_UNICODE *); 214 #endif /* Py_WIN_WIDE_FILENAMES */ 211 PyObject *,int, const Py_UNICODE *); 215 212 PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int); 216 213 #endif /* MS_WINDOWS */ … … 224 221 225 222 /* Function to create a new exception */ 226 PyAPI_FUNC(PyObject *) PyErr_NewException(char *name, PyObject *base, 227 PyObject *dict); 223 PyAPI_FUNC(PyObject *) PyErr_NewException( 224 char *name, PyObject *base, PyObject *dict); 225 PyAPI_FUNC(PyObject *) PyErr_NewExceptionWithDoc( 226 char *name, char *doc, PyObject *base, PyObject *dict); 228 227 PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *); 229 228 … … 245 244 /* create a UnicodeDecodeError object */ 246 245 PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_Create( 247 246 const char *, const char *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *); 248 247 249 248 /* create a UnicodeEncodeError object */ 250 249 PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create( 251 250 const char *, const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *); 252 251 253 252 /* create a UnicodeTranslateError object */ 254 253 PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create( 255 254 const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *); 256 255 257 256 /* get the encoding attribute */ … … 296 295 return 0 on success, -1 on failure */ 297 296 PyAPI_FUNC(int) PyUnicodeEncodeError_SetReason( 298 297 PyObject *, const char *); 299 298 PyAPI_FUNC(int) PyUnicodeDecodeError_SetReason( 300 299 PyObject *, const char *); 301 300 PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason( 302 301 PyObject *, const char *); 303 302 #endif 304 303 … … 320 319 #include <stdarg.h> 321 320 PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...) 322 321 Py_GCC_ATTRIBUTE((format(printf, 3, 4))); 323 322 PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) 324 323 Py_GCC_ATTRIBUTE((format(printf, 3, 0))); 325 324 326 325 #ifdef __cplusplus -
python/vendor/current/Include/pyexpat.h
r2 r388 5 5 6 6 #define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.0" 7 #define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI" 7 8 8 9 struct PyExpat_CAPI -
python/vendor/current/Include/pyfpe.h
r2 r388 5 5 #endif 6 6 /* 7 --------------------------------------------------------------------- 8 / Copyright (c) 1996. \ 7 --------------------------------------------------------------------- 8 / Copyright (c) 1996. \ 9 9 | The Regents of the University of California. | 10 10 | All rights reserved. | … … 38 38 | reflect those of the United States Government or the University | 39 39 | of California, and shall not be used for advertising or product | 40 \ endorsement purposes. / 41 --------------------------------------------------------------------- 40 \ endorsement purposes. / 41 --------------------------------------------------------------------- 42 42 */ 43 43 -
python/vendor/current/Include/pygetopt.h
r2 r388 10 10 PyAPI_DATA(char *) _PyOS_optarg; 11 11 12 PyAPI_FUNC(void) _PyOS_ResetGetOpt(void); 12 13 PyAPI_FUNC(int) _PyOS_GetOpt(int argc, char **argv, char *optstring); 13 14 -
python/vendor/current/Include/pymacconfig.h
r2 r388 5 5 * when building on MacOSX. This is needed for building 4-way 6 6 * universal binaries and for 64-bit universal binaries because 7 * the values redefined below aren't configure-time constant but 7 * the values redefined below aren't configure-time constant but 8 8 * only compile-time constant in these scenarios. 9 9 */ … … 17 17 # undef SIZEOF_VOID_P 18 18 # undef SIZEOF__BOOL 19 # undef SIZEOF_UINTPTR_T 20 # undef SIZEOF_PTHREAD_T 19 21 # undef WORDS_BIGENDIAN 22 # undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 23 # undef DOUBLE_IS_BIG_ENDIAN_IEEE754 24 # undef DOUBLE_IS_LITTLE_ENDIAN_IEEE754 25 # undef HAVE_GCC_ASM_FOR_X87 20 26 21 27 # undef VA_LIST_IS_ARRAY … … 31 37 # undef SIZEOF_LONG 32 38 # ifdef __LP64__ 33 # define SIZEOF__BOOL 1 34 # define SIZEOF__BOOL 1 35 # define SIZEOF_LONG 8 36 # define SIZEOF_PTHREAD_T 8 37 # define SIZEOF_SIZE_T 8 38 # define SIZEOF_TIME_T 8 39 # define SIZEOF_VOID_P 8 39 # define SIZEOF__BOOL 1 40 # define SIZEOF__BOOL 1 41 # define SIZEOF_LONG 8 42 # define SIZEOF_PTHREAD_T 8 43 # define SIZEOF_SIZE_T 8 44 # define SIZEOF_TIME_T 8 45 # define SIZEOF_VOID_P 8 46 # define SIZEOF_UINTPTR_T 8 47 # define SIZEOF_PTHREAD_T 8 40 48 # else 41 49 # ifdef __ppc__ 42 # define SIZEOF__BOOL450 # define SIZEOF__BOOL 4 43 51 # else 44 # define SIZEOF__BOOL152 # define SIZEOF__BOOL 1 45 53 # endif 46 # define SIZEOF_LONG 4 47 # define SIZEOF_PTHREAD_T 4 48 # define SIZEOF_SIZE_T 4 49 # define SIZEOF_TIME_T 4 50 # define SIZEOF_VOID_P 4 54 # define SIZEOF_LONG 4 55 # define SIZEOF_PTHREAD_T 4 56 # define SIZEOF_SIZE_T 4 57 # define SIZEOF_TIME_T 4 58 # define SIZEOF_VOID_P 4 59 # define SIZEOF_UINTPTR_T 4 60 # define SIZEOF_PTHREAD_T 4 51 61 # endif 52 62 53 63 # if defined(__LP64__) 54 /* MacOSX 10.4 (the first release to suppport 64-bit code55 * at all) only supports 64-bit in the UNIX layer. 56 57 64 /* MacOSX 10.4 (the first release to support 64-bit code 65 * at all) only supports 64-bit in the UNIX layer. 66 * Therefore surpress the toolbox-glue in 64-bit mode. 67 */ 58 68 59 60 61 62 # 69 /* In 64-bit mode setpgrp always has no argments, in 32-bit 70 * mode that depends on the compilation environment 71 */ 72 # undef SETPGRP_HAVE_ARG 63 73 64 74 # endif … … 66 76 #ifdef __BIG_ENDIAN__ 67 77 #define WORDS_BIGENDIAN 1 78 #define DOUBLE_IS_BIG_ENDIAN_IEEE754 79 #else 80 #define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 68 81 #endif /* __BIG_ENDIAN */ 69 82 70 /* 71 * The definition in pyconfig.h is only valid on the OS release 72 * where configure ran on and not necessarily for all systems where 73 * the executable can be used on. 74 * 75 * Specifically: OSX 10.4 has limited supported for '%zd', while 76 * 10.5 has full support for '%zd'. A binary built on 10.5 won't 77 * work properly on 10.4 unless we surpress the definition 78 * of PY_FORMAT_SIZE_T 79 */ 80 #undef PY_FORMAT_SIZE_T 83 #ifdef __i386__ 84 # define HAVE_GCC_ASM_FOR_X87 85 #endif 86 87 /* 88 * The definition in pyconfig.h is only valid on the OS release 89 * where configure ran on and not necessarily for all systems where 90 * the executable can be used on. 91 * 92 * Specifically: OSX 10.4 has limited supported for '%zd', while 93 * 10.5 has full support for '%zd'. A binary built on 10.5 won't 94 * work properly on 10.4 unless we surpress the definition 95 * of PY_FORMAT_SIZE_T 96 */ 97 #undef PY_FORMAT_SIZE_T 81 98 82 99 -
python/vendor/current/Include/pymath.h
r2 r388 3 3 4 4 #include "pyconfig.h" /* include for defines */ 5 6 #ifdef HAVE_STDINT_H7 #include <stdint.h>8 #endif9 5 10 6 /************************************************************************** … … 13 9 **************************************************************************/ 14 10 15 /* Python provides implementations for copysign, acosh, asinh, atanh,16 * log1p and hypot in Python/pymath.c just in case your math library doesn't17 * provide thefunctions.11 /* Python provides implementations for copysign, round and hypot in 12 * Python/pymath.c just in case your math library doesn't provide the 13 * functions. 18 14 * 19 15 *Note: PC/pyconfig.h defines copysign as _copysign … … 23 19 #endif 24 20 25 #ifndef HAVE_ACOSH 26 extern double acosh(double); 27 #endif 28 29 #ifndef HAVE_ASINH 30 extern double asinh(double); 31 #endif 32 33 #ifndef HAVE_ATANH 34 extern double atanh(double); 35 #endif 36 37 #ifndef HAVE_LOG1P 38 extern double log1p(double); 21 #ifndef HAVE_ROUND 22 extern double round(double); 39 23 #endif 40 24 … … 91 75 # define Py_FORCE_DOUBLE(X) (X) 92 76 # endif 77 #endif 78 79 #ifdef HAVE_GCC_ASM_FOR_X87 80 PyAPI_FUNC(unsigned short) _Py_get_387controlword(void); 81 PyAPI_FUNC(void) _Py_set_387controlword(unsigned short); 93 82 #endif 94 83 -
python/vendor/current/Include/pymem.h
r2 r388 60 60 #ifdef PYMALLOC_DEBUG 61 61 /* Redirect all memory operations to Python's debugging allocator. */ 62 #define PyMem_MALLOC PyObject_MALLOC63 #define PyMem_REALLOC PyObject_REALLOC64 #define PyMem_FREE PyObject_FREE62 #define PyMem_MALLOC _PyMem_DebugMalloc 63 #define PyMem_REALLOC _PyMem_DebugRealloc 64 #define PyMem_FREE _PyMem_DebugFree 65 65 66 66 #else /* ! PYMALLOC_DEBUG */ … … 72 72 /* Returns NULL to indicate error if a negative size or size larger than 73 73 Py_ssize_t can represent is supplied. Helps prevents security holes. */ 74 #define PyMem_MALLOC(n) (( (n) < 0 || (n) > PY_SSIZE_T_MAX)? NULL \74 #define PyMem_MALLOC(n) ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \ 75 75 : malloc((n) ? (n) : 1)) 76 #define PyMem_REALLOC(p, n) (( (n) < 0 || (n) > PY_SSIZE_T_MAX)? NULL \76 #define PyMem_REALLOC(p, n) ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \ 77 77 : realloc((p), (n) ? (n) : 1)) 78 78 #define PyMem_FREE free -
python/vendor/current/Include/pyport.h
r2 r388 3 3 4 4 #include "pyconfig.h" /* include for defines */ 5 6 /* Some versions of HP-UX & Solaris need inttypes.h for int32_t, 7 INT32_MAX, etc. */ 8 #ifdef HAVE_INTTYPES_H 9 #include <inttypes.h> 10 #endif 5 11 6 12 #ifdef HAVE_STDINT_H … … 81 87 #endif /* HAVE_LONG_LONG */ 82 88 89 /* a build with 30-bit digits for Python long integers needs an exact-width 90 * 32-bit unsigned integer type to store those digits. (We could just use 91 * type 'unsigned long', but that would be wasteful on a system where longs 92 * are 64-bits.) On Unix systems, the autoconf macro AC_TYPE_UINT32_T defines 93 * uint32_t to be such a type unless stdint.h or inttypes.h defines uint32_t. 94 * However, it doesn't set HAVE_UINT32_T, so we do that here. 95 */ 96 #ifdef uint32_t 97 #define HAVE_UINT32_T 1 98 #endif 99 100 #ifdef HAVE_UINT32_T 101 #ifndef PY_UINT32_T 102 #define PY_UINT32_T uint32_t 103 #endif 104 #endif 105 106 /* Macros for a 64-bit unsigned integer type; used for type 'twodigits' in the 107 * long integer implementation, when 30-bit digits are enabled. 108 */ 109 #ifdef uint64_t 110 #define HAVE_UINT64_T 1 111 #endif 112 113 #ifdef HAVE_UINT64_T 114 #ifndef PY_UINT64_T 115 #define PY_UINT64_T uint64_t 116 #endif 117 #endif 118 119 /* Signed variants of the above */ 120 #ifdef int32_t 121 #define HAVE_INT32_T 1 122 #endif 123 124 #ifdef HAVE_INT32_T 125 #ifndef PY_INT32_T 126 #define PY_INT32_T int32_t 127 #endif 128 #endif 129 130 #ifdef int64_t 131 #define HAVE_INT64_T 1 132 #endif 133 134 #ifdef HAVE_INT64_T 135 #ifndef PY_INT64_T 136 #define PY_INT64_T int64_t 137 #endif 138 #endif 139 140 /* If PYLONG_BITS_IN_DIGIT is not defined then we'll use 30-bit digits if all 141 the necessary integer types are available, and we're on a 64-bit platform 142 (as determined by SIZEOF_VOID_P); otherwise we use 15-bit digits. */ 143 144 #ifndef PYLONG_BITS_IN_DIGIT 145 #if (defined HAVE_UINT64_T && defined HAVE_INT64_T && \ 146 defined HAVE_UINT32_T && defined HAVE_INT32_T && SIZEOF_VOID_P >= 8) 147 #define PYLONG_BITS_IN_DIGIT 30 148 #else 149 #define PYLONG_BITS_IN_DIGIT 15 150 #endif 151 #endif 152 83 153 /* uintptr_t is the C9X name for an unsigned integral type such that a 84 154 * legitimate void* can be cast to uintptr_t and then back to void* again … … 87 157 */ 88 158 #ifdef HAVE_UINTPTR_T 89 typedef uintptr_t 90 typedef intptr_t 159 typedef uintptr_t Py_uintptr_t; 160 typedef intptr_t Py_intptr_t; 91 161 92 162 #elif SIZEOF_VOID_P <= SIZEOF_INT 93 typedef unsigned int 94 typedef int 163 typedef unsigned int Py_uintptr_t; 164 typedef int Py_intptr_t; 95 165 96 166 #elif SIZEOF_VOID_P <= SIZEOF_LONG 97 typedef unsigned long 98 typedef long 167 typedef unsigned long Py_uintptr_t; 168 typedef long Py_intptr_t; 99 169 100 170 #elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P <= SIZEOF_LONG_LONG) 101 typedef unsigned PY_LONG_LONG 102 typedef PY_LONG_LONG 171 typedef unsigned PY_LONG_LONG Py_uintptr_t; 172 typedef PY_LONG_LONG Py_intptr_t; 103 173 104 174 #else … … 111 181 */ 112 182 #ifdef HAVE_SSIZE_T 113 typedef ssize_t 183 typedef ssize_t Py_ssize_t; 114 184 #elif SIZEOF_VOID_P == SIZEOF_SIZE_T 115 typedef Py_intptr_t 185 typedef Py_intptr_t Py_ssize_t; 116 186 #else 117 187 # error "Python needs a typedef for Py_ssize_t in pyport.h." … … 121 191 SIZE_MAX is part of C99, so it might be defined on some 122 192 platforms. If it is not defined, (size_t)-1 is a portable 123 definition for C89, due to the way signed->unsigned 193 definition for C89, due to the way signed->unsigned 124 194 conversion is defined. */ 125 195 #ifdef SIZE_MAX … … 173 243 #endif 174 244 245 /* PY_FORMAT_LONG_LONG is analogous to PY_FORMAT_SIZE_T above, but for 246 * the long long type instead of the size_t type. It's only available 247 * when HAVE_LONG_LONG is defined. The "high level" Python format 248 * functions listed above will interpret "lld" or "llu" correctly on 249 * all platforms. 250 */ 251 #ifdef HAVE_LONG_LONG 252 # ifndef PY_FORMAT_LONG_LONG 253 # if defined(MS_WIN64) || defined(MS_WINDOWS) 254 # define PY_FORMAT_LONG_LONG "I64" 255 # else 256 # error "This platform's pyconfig.h needs to define PY_FORMAT_LONG_LONG" 257 # endif 258 # endif 259 #endif 260 175 261 /* Py_LOCAL can be used instead of static to get the fastest possible calling 176 262 * convention for functions that are local to a given module. … … 197 283 #pragma optimize("agtw", on) 198 284 #endif 199 /* ignore warnings if the compiler decides not to inline a function */ 285 /* ignore warnings if the compiler decides not to inline a function */ 200 286 #pragma warning(disable: 4710) 201 287 /* fastest possible local call under MSVC */ … … 217 303 218 304 #if defined(_MSC_VER) 219 #define Py_MEMCPY(target, source, length) do { 220 size_t i_, n_ = (length);\221 char *t_ = (void*) (target);\222 const char *s_ = (void*) (source);\223 if (n_ >= 16)\224 memcpy(t_, s_, n_);\225 else\226 for (i_ = 0; i_ < n_; i_++)\227 t_[i_] = s_[i_];\228 305 #define Py_MEMCPY(target, source, length) do { \ 306 size_t i_, n_ = (length); \ 307 char *t_ = (void*) (target); \ 308 const char *s_ = (void*) (source); \ 309 if (n_ >= 16) \ 310 memcpy(t_, s_, n_); \ 311 else \ 312 for (i_ = 0; i_ < n_; i_++) \ 313 t_[i_] = s_[i_]; \ 314 } while (0) 229 315 #else 230 316 #define Py_MEMCPY memcpy … … 232 318 233 319 #include <stdlib.h> 320 321 #ifdef HAVE_IEEEFP_H 322 #include <ieeefp.h> /* needed for 'finite' declaration on some platforms */ 323 #endif 234 324 235 325 #include <math.h> /* Moved here from the math section, before extern "C" */ … … 328 418 * or zero-fills. Here a macro to force sign extension: 329 419 * Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) 330 * Return I >> J, forcing sign extension. 420 * Return I >> J, forcing sign extension. Arithmetically, return the 421 * floor of I/2**J. 331 422 * Requirements: 332 * I is of basic signed type TYPE (char, short, int, long, or long long). 333 * TYPE is one of char, short, int, long, or long long, although long long 334 * must not be used except on platforms that support it. 335 * J is an integer >= 0 and strictly less than the number of bits in TYPE 336 * (because C doesn't define what happens for J outside that range either). 423 * I should have signed integer type. In the terminology of C99, this can 424 * be either one of the five standard signed integer types (signed char, 425 * short, int, long, long long) or an extended signed integer type. 426 * J is an integer >= 0 and strictly less than the number of bits in the 427 * type of I (because C doesn't define what happens for J outside that 428 * range either). 429 * TYPE used to specify the type of I, but is now ignored. It's been left 430 * in for backwards compatibility with versions <= 2.6 or 3.0. 337 431 * Caution: 338 432 * I may be evaluated more than once. … … 340 434 #ifdef SIGNED_RIGHT_SHIFT_ZERO_FILLS 341 435 #define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) \ 342 ((I) < 0 ? ~((~(unsigned TYPE)(I)) >> (J)) : (I) >> (J))436 ((I) < 0 ? -1-((-1-(I)) >> (J)) : (I) >> (J)) 343 437 #else 344 438 #define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) ((I) >> (J)) … … 360 454 #ifdef Py_DEBUG 361 455 #define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) \ 362 456 (assert((WIDE)(NARROW)(VALUE) == (VALUE)), (NARROW)(VALUE)) 363 457 #else 364 458 #define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) (NARROW)(VALUE) … … 380 474 #endif 381 475 #define Py_SET_ERRNO_ON_MATH_ERROR(X) \ 382 383 384 385 386 387 388 476 do { \ 477 if (errno == 0) { \ 478 if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \ 479 errno = ERANGE; \ 480 else _Py_SET_EDOM_FOR_NAN(X) \ 481 } \ 482 } while(0) 389 483 390 484 /* Py_SET_ERANGE_ON_OVERFLOW(x) … … 407 501 * X and Y may be evaluated more than once. 408 502 */ 409 #define Py_ADJUST_ERANGE1(X) \ 410 do { \ 411 if (errno == 0) { \ 412 if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \ 413 errno = ERANGE; \ 414 } \ 415 else if (errno == ERANGE && (X) == 0.0) \ 416 errno = 0; \ 417 } while(0) 418 419 #define Py_ADJUST_ERANGE2(X, Y) \ 420 do { \ 421 if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL || \ 422 (Y) == Py_HUGE_VAL || (Y) == -Py_HUGE_VAL) { \ 423 if (errno == 0) \ 424 errno = ERANGE; \ 425 } \ 426 else if (errno == ERANGE) \ 427 errno = 0; \ 428 } while(0) 503 #define Py_ADJUST_ERANGE1(X) \ 504 do { \ 505 if (errno == 0) { \ 506 if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \ 507 errno = ERANGE; \ 508 } \ 509 else if (errno == ERANGE && (X) == 0.0) \ 510 errno = 0; \ 511 } while(0) 512 513 #define Py_ADJUST_ERANGE2(X, Y) \ 514 do { \ 515 if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL || \ 516 (Y) == Py_HUGE_VAL || (Y) == -Py_HUGE_VAL) { \ 517 if (errno == 0) \ 518 errno = ERANGE; \ 519 } \ 520 else if (errno == ERANGE) \ 521 errno = 0; \ 522 } while(0) 523 524 /* The functions _Py_dg_strtod and _Py_dg_dtoa in Python/dtoa.c (which are 525 * required to support the short float repr introduced in Python 3.1) require 526 * that the floating-point unit that's being used for arithmetic operations 527 * on C doubles is set to use 53-bit precision. It also requires that the 528 * FPU rounding mode is round-half-to-even, but that's less often an issue. 529 * 530 * If your FPU isn't already set to 53-bit precision/round-half-to-even, and 531 * you want to make use of _Py_dg_strtod and _Py_dg_dtoa, then you should 532 * 533 * #define HAVE_PY_SET_53BIT_PRECISION 1 534 * 535 * and also give appropriate definitions for the following three macros: 536 * 537 * _PY_SET_53BIT_PRECISION_START : store original FPU settings, and 538 * set FPU to 53-bit precision/round-half-to-even 539 * _PY_SET_53BIT_PRECISION_END : restore original FPU settings 540 * _PY_SET_53BIT_PRECISION_HEADER : any variable declarations needed to 541 * use the two macros above. 542 * 543 * The macros are designed to be used within a single C function: see 544 * Python/pystrtod.c for an example of their use. 545 */ 546 547 /* get and set x87 control word for gcc/x86 */ 548 #ifdef HAVE_GCC_ASM_FOR_X87 549 #define HAVE_PY_SET_53BIT_PRECISION 1 550 /* _Py_get/set_387controlword functions are defined in Python/pymath.c */ 551 #define _Py_SET_53BIT_PRECISION_HEADER \ 552 unsigned short old_387controlword, new_387controlword 553 #define _Py_SET_53BIT_PRECISION_START \ 554 do { \ 555 old_387controlword = _Py_get_387controlword(); \ 556 new_387controlword = (old_387controlword & ~0x0f00) | 0x0200; \ 557 if (new_387controlword != old_387controlword) \ 558 _Py_set_387controlword(new_387controlword); \ 559 } while (0) 560 #define _Py_SET_53BIT_PRECISION_END \ 561 if (new_387controlword != old_387controlword) \ 562 _Py_set_387controlword(old_387controlword) 563 #endif 564 565 /* get and set x87 control word for VisualStudio/x86 */ 566 #if defined(_MSC_VER) && !defined(_WIN64) /* x87 not supported in 64-bit */ 567 #define HAVE_PY_SET_53BIT_PRECISION 1 568 #define _Py_SET_53BIT_PRECISION_HEADER \ 569 unsigned int old_387controlword, new_387controlword, out_387controlword 570 /* We use the __control87_2 function to set only the x87 control word. 571 The SSE control word is unaffected. */ 572 #define _Py_SET_53BIT_PRECISION_START \ 573 do { \ 574 __control87_2(0, 0, &old_387controlword, NULL); \ 575 new_387controlword = \ 576 (old_387controlword & ~(_MCW_PC | _MCW_RC)) | (_PC_53 | _RC_NEAR); \ 577 if (new_387controlword != old_387controlword) \ 578 __control87_2(new_387controlword, _MCW_PC | _MCW_RC, \ 579 &out_387controlword, NULL); \ 580 } while (0) 581 #define _Py_SET_53BIT_PRECISION_END \ 582 do { \ 583 if (new_387controlword != old_387controlword) \ 584 __control87_2(old_387controlword, _MCW_PC | _MCW_RC, \ 585 &out_387controlword, NULL); \ 586 } while (0) 587 #endif 588 589 /* default definitions are empty */ 590 #ifndef HAVE_PY_SET_53BIT_PRECISION 591 #define _Py_SET_53BIT_PRECISION_HEADER 592 #define _Py_SET_53BIT_PRECISION_START 593 #define _Py_SET_53BIT_PRECISION_END 594 #endif 595 596 /* If we can't guarantee 53-bit precision, don't use the code 597 in Python/dtoa.c, but fall back to standard code. This 598 means that repr of a float will be long (17 sig digits). 599 600 Realistically, there are two things that could go wrong: 601 602 (1) doubles aren't IEEE 754 doubles, or 603 (2) we're on x86 with the rounding precision set to 64-bits 604 (extended precision), and we don't know how to change 605 the rounding precision. 606 */ 607 608 #if !defined(DOUBLE_IS_LITTLE_ENDIAN_IEEE754) && \ 609 !defined(DOUBLE_IS_BIG_ENDIAN_IEEE754) && \ 610 !defined(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754) 611 #define PY_NO_SHORT_FLOAT_REPR 612 #endif 613 614 /* double rounding is symptomatic of use of extended precision on x86. If 615 we're seeing double rounding, and we don't have any mechanism available for 616 changing the FPU rounding precision, then don't use Python/dtoa.c. */ 617 #if defined(X87_DOUBLE_ROUNDING) && !defined(HAVE_PY_SET_53BIT_PRECISION) 618 #define PY_NO_SHORT_FLOAT_REPR 619 #endif 429 620 430 621 /* Py_DEPRECATED(version) … … 436 627 */ 437 628 #if defined(__GNUC__) && ((__GNUC__ >= 4) || \ 438 629 (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)) 439 630 #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__)) 440 631 #else … … 462 653 463 654 #ifdef HAVE__GETPTY 464 #include <sys/types.h> 655 #include <sys/types.h> /* we need to import mode_t */ 465 656 extern char * _getpty(int *, int, mode_t, int); 466 657 #endif … … 469 660 if TCGETA, TCSETA, TCSETAW, or TCSETAF are used. sys/termio.h must 470 661 be included before termios.h or it will generate an error. */ 471 #if def HAVE_SYS_TERMIO_H662 #if defined(HAVE_SYS_TERMIO_H) && !defined(__hpux) 472 663 #include <sys/termio.h> 473 664 #endif 474 665 475 666 #if defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) 476 #if !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) 667 #if !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) && !defined(HAVE_UTIL_H) 477 668 /* BSDI does not supply a prototype for the 'openpty' and 'forkpty' 478 669 functions, even though they are included in libutil. */ … … 513 704 #include <osreldate.h> 514 705 #if __FreeBSD_version > 500039 706 # define _PY_PORT_CTYPE_UTF8_ISSUE 707 #endif 708 #endif 709 710 711 #if defined(__APPLE__) 712 # define _PY_PORT_CTYPE_UTF8_ISSUE 713 #endif 714 715 #ifdef _PY_PORT_CTYPE_UTF8_ISSUE 515 716 #include <ctype.h> 516 717 #include <wctype.h> … … 530 731 #define toupper(c) towupper(btowc(c)) 531 732 #endif 532 #endif533 733 534 734 … … 553 753 */ 554 754 #if defined(__CYGWIN__) || defined(__BEOS__) 555 # 755 # define HAVE_DECLSPEC_DLL 556 756 #endif 557 757 558 758 /* only get special linkage if built as shared or platform is Cygwin */ 559 759 #if defined(Py_ENABLE_SHARED) || defined(__CYGWIN__) 560 # if defined(HAVE_DECLSPEC_DLL) 561 # ifdef Py_BUILD_CORE 562 # define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE 563 # define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE 564 /* module init functions inside the core need no external linkage */ 565 /* except for Cygwin to handle embedding (FIXME: BeOS too?) */ 566 # if defined(__CYGWIN__) 567 # define PyMODINIT_FUNC __declspec(dllexport) void 568 # else /* __CYGWIN__ */ 569 # define PyMODINIT_FUNC void 570 # endif /* __CYGWIN__ */ 571 # else /* Py_BUILD_CORE */ 572 /* Building an extension module, or an embedded situation */ 573 /* public Python functions and data are imported */ 574 /* Under Cygwin, auto-import functions to prevent compilation */ 575 /* failures similar to http://python.org/doc/FAQ.html#3.24 */ 576 # if !defined(__CYGWIN__) 577 # define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE 578 # endif /* !__CYGWIN__ */ 579 # define PyAPI_DATA(RTYPE) extern __declspec(dllimport) RTYPE 580 /* module init functions outside the core must be exported */ 581 # if defined(__cplusplus) 582 # define PyMODINIT_FUNC extern "C" __declspec(dllexport) void 583 # else /* __cplusplus */ 584 # define PyMODINIT_FUNC __declspec(dllexport) void 585 # endif /* __cplusplus */ 586 # endif /* Py_BUILD_CORE */ 587 # endif /* HAVE_DECLSPEC */ 760 # if defined(HAVE_DECLSPEC_DLL) 761 # ifdef Py_BUILD_CORE 762 # define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE 763 # define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE 764 /* module init functions inside the core need no external linkage */ 765 /* except for Cygwin to handle embedding (FIXME: BeOS too?) */ 766 # if defined(__CYGWIN__) 767 # define PyMODINIT_FUNC __declspec(dllexport) void 768 # else /* __CYGWIN__ */ 769 # define PyMODINIT_FUNC void 770 # endif /* __CYGWIN__ */ 771 # else /* Py_BUILD_CORE */ 772 /* Building an extension module, or an embedded situation */ 773 /* public Python functions and data are imported */ 774 /* Under Cygwin, auto-import functions to prevent compilation */ 775 /* failures similar to those described at the bottom of 4.1: */ 776 /* http://docs.python.org/extending/windows.html#a-cookbook-approach */ 777 # if !defined(__CYGWIN__) 778 # define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE 779 # endif /* !__CYGWIN__ */ 780 # define PyAPI_DATA(RTYPE) extern __declspec(dllimport) RTYPE 781 /* module init functions outside the core must be exported */ 782 # if defined(__cplusplus) 783 # define PyMODINIT_FUNC extern "C" __declspec(dllexport) void 784 # else /* __cplusplus */ 785 # define PyMODINIT_FUNC __declspec(dllexport) void 786 # endif /* __cplusplus */ 787 # endif /* Py_BUILD_CORE */ 788 # endif /* HAVE_DECLSPEC */ 588 789 #endif /* Py_ENABLE_SHARED */ 589 790 590 791 /* If no external linkage macros defined by now, create defaults */ 591 792 #ifndef PyAPI_FUNC 592 # 793 # define PyAPI_FUNC(RTYPE) RTYPE 593 794 #endif 594 795 #ifndef PyAPI_DATA 595 # 796 # define PyAPI_DATA(RTYPE) extern RTYPE 596 797 #endif 597 798 #ifndef PyMODINIT_FUNC 598 # 599 # 600 # 601 # 602 # 799 # if defined(__cplusplus) 800 # define PyMODINIT_FUNC extern "C" void 801 # else /* __cplusplus */ 802 # define PyMODINIT_FUNC void 803 # endif /* __cplusplus */ 603 804 #endif 604 805 605 806 /* Deprecated DL_IMPORT and DL_EXPORT macros */ 606 807 #if defined(Py_ENABLE_SHARED) && defined (HAVE_DECLSPEC_DLL) 607 # 608 # 609 # 610 # 611 # 612 # 613 # 808 # if defined(Py_BUILD_CORE) 809 # define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE 810 # define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE 811 # else 812 # define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE 813 # define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE 814 # endif 614 815 #endif 615 816 #ifndef DL_EXPORT 616 # 817 # define DL_EXPORT(RTYPE) RTYPE 617 818 #endif 618 819 #ifndef DL_IMPORT 619 # 820 # define DL_IMPORT(RTYPE) RTYPE 620 821 #endif 621 822 /* End of deprecated DL_* macros */ … … 626 827 #if 0 /* disabled and probably obsolete */ 627 828 628 #ifndef 629 #define FD_SETSIZE256829 #ifndef FD_SETSIZE 830 #define FD_SETSIZE 256 630 831 #endif 631 832 … … 634 835 typedef long fd_mask; 635 836 636 #define NFDBITS (sizeof(fd_mask) * NBBY)/* bits per mask */837 #define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */ 637 838 #ifndef howmany 638 #define howmany(x, y)(((x)+((y)-1))/(y))839 #define howmany(x, y) (((x)+((y)-1))/(y)) 639 840 #endif /* howmany */ 640 841 641 typedef 642 fd_maskfds_bits[howmany(FD_SETSIZE, NFDBITS)];842 typedef struct fd_set { 843 fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; 643 844 } fd_set; 644 845 645 #define FD_SET(n, p)((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))646 #define FD_CLR(n, p)((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))647 #define FD_ISSET(n, p)((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))648 #define FD_ZERO(p) 846 #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) 847 #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) 848 #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) 849 #define FD_ZERO(p) memset((char *)(p), '\0', sizeof(*(p))) 649 850 650 851 #endif /* FD_SET */ -
python/vendor/current/Include/pystate.h
r2 r388 96 96 long thread_id; /* Thread id where this tstate was created */ 97 97 98 int trash_delete_nesting; 99 PyObject *trash_delete_later; 100 98 101 /* XXX signal handlers should also be here */ 99 102 … … 106 109 107 110 PyAPI_FUNC(PyThreadState *) PyThreadState_New(PyInterpreterState *); 111 PyAPI_FUNC(PyThreadState *) _PyThreadState_Prealloc(PyInterpreterState *); 112 PyAPI_FUNC(void) _PyThreadState_Init(PyThreadState *); 108 113 PyAPI_FUNC(void) PyThreadState_Clear(PyThreadState *); 109 114 PyAPI_FUNC(void) PyThreadState_Delete(PyThreadState *); … … 167 172 /* Helper/diagnostic function - get the current thread state for 168 173 this thread. May return NULL if no GILState API has been used 169 on the current thread. Note th e main thread always has such a174 on the current thread. Note that the main thread always has such a 170 175 thread-state, even if no auto-thread-state call has been made 171 176 on the main thread. -
python/vendor/current/Include/pystrtod.h
r2 r388 9 9 PyAPI_FUNC(double) PyOS_ascii_strtod(const char *str, char **ptr); 10 10 PyAPI_FUNC(double) PyOS_ascii_atof(const char *str); 11 PyAPI_FUNC(char *) PyOS_ascii_formatd(char *buffer, size_t buf_len, const char *format, double d);12 11 12 /* Deprecated in 2.7 and 3.1. Will disappear in 2.8 (if it exists) and 3.2 */ 13 PyAPI_FUNC(char *) PyOS_ascii_formatd(char *buffer, size_t buf_len, 14 const char *format, double d); 15 PyAPI_FUNC(double) PyOS_string_to_double(const char *str, 16 char **endptr, 17 PyObject *overflow_exception); 18 19 /* The caller is responsible for calling PyMem_Free to free the buffer 20 that's is returned. */ 21 PyAPI_FUNC(char *) PyOS_double_to_string(double val, 22 char format_code, 23 int precision, 24 int flags, 25 int *type); 26 27 PyAPI_FUNC(double) _Py_parse_inf_or_nan(const char *p, char **endptr); 28 29 30 /* PyOS_double_to_string's "flags" parameter can be set to 0 or more of: */ 31 #define Py_DTSF_SIGN 0x01 /* always add the sign */ 32 #define Py_DTSF_ADD_DOT_0 0x02 /* if the result is an integer add ".0" */ 33 #define Py_DTSF_ALT 0x04 /* "alternate" formatting. it's format_code 34 specific */ 35 36 /* PyOS_double_to_string's "type", if non-NULL, will be set to one of: */ 37 #define Py_DTST_FINITE 0 38 #define Py_DTST_INFINITE 1 39 #define Py_DTST_NAN 2 13 40 14 41 #ifdef __cplusplus -
python/vendor/current/Include/pythonrun.h
r2 r388 17 17 18 18 typedef struct { 19 19 int cf_flags; /* bitmask of CO_xxx flags relevant to future */ 20 20 } PyCompilerFlags; 21 21 … … 40 40 PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(FILE *, const char *, PyCompilerFlags *); 41 41 42 PyAPI_FUNC(struct _mod *) PyParser_ASTFromString(const char *, const char *, 43 42 PyAPI_FUNC(struct _mod *) PyParser_ASTFromString(const char *, const char *, 43 int, PyCompilerFlags *flags, 44 44 PyArena *); 45 PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile(FILE *, const char *, int, 46 45 PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile(FILE *, const char *, int, 46 char *, char *, 47 47 PyCompilerFlags *, int *, 48 48 PyArena *); 49 49 #define PyParser_SimpleParseString(S, B) \ 50 50 PyParser_SimpleParseStringFlags(S, B, 0) 51 51 #define PyParser_SimpleParseFile(FP, S, B) \ 52 53 PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int, 54 52 PyParser_SimpleParseFileFlags(FP, S, B, 0) 53 PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int, 54 int); 55 55 PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *, 56 56 int, int); 57 57 58 PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *, 59 58 PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *, 59 PyObject *, PyCompilerFlags *); 60 60 61 PyAPI_FUNC(PyObject *) PyRun_FileExFlags(FILE *, const char *, int, 62 PyObject *, PyObject *, int, 63 61 PyAPI_FUNC(PyObject *) PyRun_FileExFlags(FILE *, const char *, int, 62 PyObject *, PyObject *, int, 63 PyCompilerFlags *); 64 64 65 65 #define Py_CompileString(str, p, s) Py_CompileStringFlags(str, p, s, NULL) 66 66 PyAPI_FUNC(PyObject *) Py_CompileStringFlags(const char *, const char *, int, 67 67 PyCompilerFlags *); 68 68 PyAPI_FUNC(struct symtable *) Py_SymtableString(const char *, const char *, int); 69 69 … … 85 85 #define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL) 86 86 #define PyRun_AnyFileEx(fp, name, closeit) \ 87 87 PyRun_AnyFileExFlags(fp, name, closeit, NULL) 88 88 #define PyRun_AnyFileFlags(fp, name, flags) \ 89 89 PyRun_AnyFileExFlags(fp, name, 0, flags) 90 90 #define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL) 91 91 #define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL) … … 94 94 #define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL) 95 95 #define PyRun_File(fp, p, s, g, l) \ 96 96 PyRun_FileExFlags(fp, p, s, g, l, 0, NULL) 97 97 #define PyRun_FileEx(fp, p, s, g, l, c) \ 98 98 PyRun_FileExFlags(fp, p, s, g, l, c, NULL) 99 99 #define PyRun_FileFlags(fp, p, s, g, l, flags) \ 100 100 PyRun_FileExFlags(fp, p, s, g, l, 0, flags) 101 101 102 102 /* In getpath.c */ … … 115 115 PyAPI_FUNC(const char *) Py_SubversionRevision(void); 116 116 PyAPI_FUNC(const char *) Py_SubversionShortBranch(void); 117 PyAPI_FUNC(const char *) _Py_hgidentifier(void); 118 PyAPI_FUNC(const char *) _Py_hgversion(void); 117 119 118 120 /* Internal -- various one-time initializations */ … … 124 126 PyAPI_FUNC(int) _PyFrame_Init(void); 125 127 PyAPI_FUNC(int) _PyInt_Init(void); 128 PyAPI_FUNC(int) _PyLong_Init(void); 126 129 PyAPI_FUNC(void) _PyFloat_Init(void); 127 130 PyAPI_FUNC(int) PyByteArray_Init(void); 131 PyAPI_FUNC(void) _PyRandom_Init(void); 128 132 129 133 /* Various internal finalizers */ … … 169 173 PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t); 170 174 175 /* Random */ 176 PyAPI_FUNC(int) _PyOS_URandom (void *buffer, Py_ssize_t size); 171 177 172 178 #ifdef __cplusplus -
python/vendor/current/Include/pythread.h
r2 r388 2 2 #ifndef Py_PYTHREAD_H 3 3 #define Py_PYTHREAD_H 4 5 #define NO_EXIT_PROG /* don't define PyThread_exit_prog() */6 /* (the result is no use of signals on SGI) */7 4 8 5 typedef void *PyThread_type_lock; … … 16 13 PyAPI_FUNC(long) PyThread_start_new_thread(void (*)(void *), void *); 17 14 PyAPI_FUNC(void) PyThread_exit_thread(void); 18 PyAPI_FUNC(void) PyThread__PyThread_exit_thread(void);19 15 PyAPI_FUNC(long) PyThread_get_thread_ident(void); 20 16 … … 28 24 PyAPI_FUNC(size_t) PyThread_get_stacksize(void); 29 25 PyAPI_FUNC(int) PyThread_set_stacksize(size_t); 30 31 #ifndef NO_EXIT_PROG32 PyAPI_FUNC(void) PyThread_exit_prog(int);33 PyAPI_FUNC(void) PyThread__PyThread_exit_prog(int);34 #endif35 26 36 27 /* Thread Local Storage (TLS) API */ -
python/vendor/current/Include/setobject.h
r2 r388 23 23 24 24 typedef struct { 25 26 25 long hash; /* cached hash code for the entry key */ 26 PyObject *key; 27 27 } setentry; 28 28 … … 34 34 typedef struct _setobject PySetObject; 35 35 struct _setobject { 36 36 PyObject_HEAD 37 37 38 39 38 Py_ssize_t fill; /* # Active + # Dummy */ 39 Py_ssize_t used; /* # Active */ 40 40 41 42 43 44 45 41 /* The table contains mask + 1 slots, and that's a power of 2. 42 * We store the mask instead of the size because the mask is more 43 * frequently needed. 44 */ 45 Py_ssize_t mask; 46 46 47 48 49 50 51 52 53 47 /* table points to smalltable for small tables, else to 48 * additional malloc'ed memory. table is never NULL! This rule 49 * saves repeated runtime null-tests. 50 */ 51 setentry *table; 52 setentry *(*lookup)(PySetObject *so, PyObject *key, long hash); 53 setentry smalltable[PySet_MINSIZE]; 54 54 55 long hash;/* only used by frozenset objects */56 PyObject *weakreflist;/* List of weak references */55 long hash; /* only used by frozenset objects */ 56 PyObject *weakreflist; /* List of weak references */ 57 57 }; 58 58 … … 69 69 #define PyFrozenSet_CheckExact(ob) (Py_TYPE(ob) == &PyFrozenSet_Type) 70 70 #define PyAnySet_CheckExact(ob) \ 71 71 (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type) 72 72 #define PyAnySet_Check(ob) \ 73 74 75 73 (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type || \ 74 PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \ 75 PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type)) 76 76 #define PySet_Check(ob) \ 77 78 77 (Py_TYPE(ob) == &PySet_Type || \ 78 PyType_IsSubtype(Py_TYPE(ob), &PySet_Type)) 79 79 #define PyFrozenSet_Check(ob) \ 80 81 80 (Py_TYPE(ob) == &PyFrozenSet_Type || \ 81 PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type)) 82 82 83 83 PyAPI_FUNC(PyObject *) PySet_New(PyObject *); -
python/vendor/current/Include/stringobject.h
r2 r388 178 178 ); 179 179 180 180 181 /* Using the current locale, insert the thousands grouping 181 182 into the string pointed to by buffer. For the argument descriptions, 182 183 see Objects/stringlib/localeutil.h */ 183 184 PyAPI_FUNC(int) _PyString_InsertThousandsGrouping(char *buffer, 185 Py_ssize_t n_buffer, 186 Py_ssize_t n_digits, 187 Py_ssize_t buf_size, 188 Py_ssize_t *count, 189 int append_zero_char); 184 PyAPI_FUNC(Py_ssize_t) _PyString_InsertThousandsGroupingLocale(char *buffer, 185 Py_ssize_t n_buffer, 186 char *digits, 187 Py_ssize_t n_digits, 188 Py_ssize_t min_width); 189 190 /* Using explicit passed-in values, insert the thousands grouping 191 into the string pointed to by buffer. For the argument descriptions, 192 see Objects/stringlib/localeutil.h */ 193 PyAPI_FUNC(Py_ssize_t) _PyString_InsertThousandsGrouping(char *buffer, 194 Py_ssize_t n_buffer, 195 char *digits, 196 Py_ssize_t n_digits, 197 Py_ssize_t min_width, 198 const char *grouping, 199 const char *thousands_sep); 190 200 191 201 /* Format the object based on the format_spec, as defined in PEP 3101 -
python/vendor/current/Include/structmember.h
r2 r388 27 27 28 28 struct memberlist { 29 30 31 32 33 29 /* Obsolete version, for binary backwards compatibility */ 30 char *name; 31 int type; 32 int offset; 33 int flags; 34 34 }; 35 35 36 36 typedef struct PyMemberDef { 37 38 39 40 41 42 37 /* Current version, use this */ 38 char *name; 39 int type; 40 Py_ssize_t offset; 41 int flags; 42 char *doc; 43 43 } PyMemberDef; 44 44 45 45 /* Types */ 46 #define T_SHORT 47 #define T_INT 48 #define T_LONG 49 #define T_FLOAT 50 #define T_DOUBLE 51 #define T_STRING 52 #define T_OBJECT 46 #define T_SHORT 0 47 #define T_INT 1 48 #define T_LONG 2 49 #define T_FLOAT 3 50 #define T_DOUBLE 4 51 #define T_STRING 5 52 #define T_OBJECT 6 53 53 /* XXX the ordering here is weird for binary compatibility */ 54 #define T_CHAR 7/* 1-character string */55 #define T_BYTE 8/* 8-bit signed int */54 #define T_CHAR 7 /* 1-character string */ 55 #define T_BYTE 8 /* 8-bit signed int */ 56 56 /* unsigned variants: */ 57 #define T_UBYTE 58 #define T_USHORT 59 #define T_UINT 60 #define T_ULONG 57 #define T_UBYTE 9 58 #define T_USHORT 10 59 #define T_UINT 11 60 #define T_ULONG 12 61 61 62 62 /* Added by Jack: strings contained in the structure */ 63 #define T_STRING_INPLACE 63 #define T_STRING_INPLACE 13 64 64 65 65 /* Added by Lillo: bools contained in the structure (assumed char) */ 66 #define T_BOOL 66 #define T_BOOL 14 67 67 68 #define T_OBJECT_EX 16/* Like T_OBJECT, but raises AttributeError69 70 68 #define T_OBJECT_EX 16 /* Like T_OBJECT, but raises AttributeError 69 when the value is NULL, instead of 70 converting to None. */ 71 71 #ifdef HAVE_LONG_LONG 72 #define T_LONGLONG 17 72 #define T_LONGLONG 17 73 73 #define T_ULONGLONG 18 74 74 #endif /* HAVE_LONG_LONG */ … … 78 78 79 79 /* Flags */ 80 #define READONLY 81 #define RO READONLY/* Shorthand */82 #define READ_RESTRICTED 80 #define READONLY 1 81 #define RO READONLY /* Shorthand */ 82 #define READ_RESTRICTED 2 83 83 #define PY_WRITE_RESTRICTED 4 84 #define RESTRICTED 84 #define RESTRICTED (READ_RESTRICTED | PY_WRITE_RESTRICTED) 85 85 86 86 -
python/vendor/current/Include/symtable.h
r2 r388 12 12 13 13 struct symtable { 14 const char *st_filename; /* name of file being compiled */ 15 struct _symtable_entry *st_cur; /* current symbol table entry */ 16 struct _symtable_entry *st_top; /* module entry */ 17 PyObject *st_symbols; /* dictionary of symbol table entries */ 18 PyObject *st_stack; /* stack of namespace info */ 19 PyObject *st_global; /* borrowed ref to MODULE in st_symbols */ 20 int st_nblocks; /* number of blocks */ 21 PyObject *st_private; /* name of current class or NULL */ 22 int st_tmpname; /* temporary name counter */ 23 PyFutureFeatures *st_future; /* module's future features */ 14 const char *st_filename; /* name of file being compiled */ 15 struct _symtable_entry *st_cur; /* current symbol table entry */ 16 struct _symtable_entry *st_top; /* module entry */ 17 PyObject *st_symbols; /* dictionary of symbol table entries */ 18 PyObject *st_stack; /* stack of namespace info */ 19 PyObject *st_global; /* borrowed ref to MODULE in st_symbols */ 20 int st_nblocks; /* number of blocks */ 21 PyObject *st_private; /* name of current class or NULL */ 22 PyFutureFeatures *st_future; /* module's future features */ 24 23 }; 25 24 26 25 typedef struct _symtable_entry { 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 26 PyObject_HEAD 27 PyObject *ste_id; /* int: key in st_symbols */ 28 PyObject *ste_symbols; /* dict: name to flags */ 29 PyObject *ste_name; /* string: name of block */ 30 PyObject *ste_varnames; /* list of variable names */ 31 PyObject *ste_children; /* list of child ids */ 32 _Py_block_ty ste_type; /* module, class, or function */ 33 int ste_unoptimized; /* false if namespace is optimized */ 34 int ste_nested; /* true if block is nested */ 35 unsigned ste_free : 1; /* true if block has free variables */ 36 unsigned ste_child_free : 1; /* true if a child block has free vars, 37 including free refs to globals */ 38 unsigned ste_generator : 1; /* true if namespace is a generator */ 39 unsigned ste_varargs : 1; /* true if block has varargs */ 40 unsigned ste_varkeywords : 1; /* true if block has varkeywords */ 41 unsigned ste_returns_value : 1; /* true if namespace uses return with 42 an argument */ 43 int ste_lineno; /* first line of block */ 44 int ste_opt_lineno; /* lineno of last exec or import * */ 45 int ste_tmpname; /* counter for listcomp temp vars */ 46 struct symtable *ste_table; 48 47 } PySTEntryObject; 49 48 … … 54 53 PyAPI_FUNC(int) PyST_GetScope(PySTEntryObject *, PyObject *); 55 54 56 PyAPI_FUNC(struct symtable *) PySymtable_Build(mod_ty, const char *, 57 55 PyAPI_FUNC(struct symtable *) PySymtable_Build(mod_ty, const char *, 56 PyFutureFeatures *); 58 57 PyAPI_FUNC(PySTEntryObject *) PySymtable_Lookup(struct symtable *, void *); 59 58 … … 66 65 #define DEF_PARAM 2<<1 /* formal parameter */ 67 66 #define USE 2<<2 /* name is used */ 68 #define DEF_STAR 2<<3 /* parameter is star arg */ 69 #define DEF_DOUBLESTAR 2<<4 /* parameter is star-star arg */ 70 #define DEF_INTUPLE 2<<5 /* name defined in tuple in parameters */ 71 #define DEF_FREE 2<<6 /* name used but not defined in nested block */ 72 #define DEF_FREE_GLOBAL 2<<7 /* free variable is actually implicit global */ 73 #define DEF_FREE_CLASS 2<<8 /* free variable from class's method */ 74 #define DEF_IMPORT 2<<9 /* assignment occurred via import */ 67 #define DEF_FREE 2<<3 /* name used but not defined in nested block */ 68 #define DEF_FREE_CLASS 2<<4 /* free variable from class's method */ 69 #define DEF_IMPORT 2<<5 /* assignment occurred via import */ 75 70 76 71 #define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT) 77 72 78 73 /* GLOBAL_EXPLICIT and GLOBAL_IMPLICIT are used internally by the symbol 79 table. GLOBAL is returned from PyST_GetScope() for either of them. 74 table. GLOBAL is returned from PyST_GetScope() for either of them. 80 75 It is stored in ste_symbols at bits 12-14. 81 76 */ -
python/vendor/current/Include/sysmodule.h
r2 r388 12 12 PyAPI_FUNC(FILE *) PySys_GetFile(char *, FILE *); 13 13 PyAPI_FUNC(void) PySys_SetArgv(int, char **); 14 PyAPI_FUNC(void) PySys_SetArgvEx(int, char **, int); 14 15 PyAPI_FUNC(void) PySys_SetPath(char *); 15 16 … … 18 19 PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) 19 20 Py_GCC_ATTRIBUTE((format(printf, 1, 2))); 20 21 PyAPI_DATA(PyObject *) _PySys_TraceFunc, *_PySys_ProfileFunc;22 PyAPI_DATA(int) _PySys_CheckInterval;23 21 24 22 PyAPI_FUNC(void) PySys_ResetWarnOptions(void); -
python/vendor/current/Include/timefuncs.h
r2 r388 17 17 PyAPI_FUNC(time_t) _PyTime_DoubleToTimet(double x); 18 18 19 /* Get the current time since the epoch in seconds */ 20 PyAPI_FUNC(double) _PyTime_FloatTime(void); 21 19 22 20 23 #ifdef __cplusplus -
python/vendor/current/Include/token.h
r2 r388 7 7 extern "C" { 8 8 #endif 9 10 #undef TILDE /* Prevent clash of our definition with system macro. Ex AIX, ioctl.h */ 9 11 10 12 #define ENDMARKER 0 -
python/vendor/current/Include/tupleobject.h
r2 r388 45 45 PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, Py_ssize_t); 46 46 PyAPI_FUNC(PyObject *) PyTuple_Pack(Py_ssize_t, ...); 47 PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *); 47 48 48 49 /* Macro, trading safety for speed */ -
python/vendor/current/Include/ucnhash.h
r2 r388 7 7 #endif 8 8 9 /* revised ucnhash CAPI interface (exported through a PyCObject) */ 9 /* revised ucnhash CAPI interface (exported through a "wrapper") */ 10 11 #define PyUnicodeData_CAPSULE_NAME "unicodedata.ucnhash_CAPI" 10 12 11 13 typedef struct { -
python/vendor/current/Include/unicodeobject.h
r2 r388 29 29 * -------------------------------------------------------------------- 30 30 * This Unicode String Type is 31 * 31 * 32 32 * Copyright (c) 1999 by Secret Labs AB 33 33 * Copyright (c) 1999 by Fredrik Lundh 34 * 34 * 35 35 * By obtaining, using, and/or copying this software and/or its 36 36 * associated documentation, you agree that you have read, understood, 37 37 * and will comply with the following terms and conditions: 38 * 38 * 39 39 * Permission to use, copy, modify, and distribute this software and its 40 40 * associated documentation for any purpose and without fee is hereby … … 45 45 * distribution of the software without specific, written prior 46 46 * permission. 47 * 47 * 48 48 * SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO 49 49 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND … … 125 125 * as single unsigned integer. 126 126 */ 127 #if SIZEOF_INT >= 4 128 typedef unsigned int Py_UCS4; 127 #if SIZEOF_INT >= 4 128 typedef unsigned int Py_UCS4; 129 129 #elif SIZEOF_LONG >= 4 130 typedef unsigned long Py_UCS4; 130 typedef unsigned long Py_UCS4; 131 131 #endif 132 132 … … 362 362 */ 363 363 #define Py_UNICODE_ISSPACE(ch) \ 364 364 ((ch) < 128U ? _Py_ascii_whitespace[(ch)] : _PyUnicode_IsWhitespace(ch)) 365 365 366 366 #define Py_UNICODE_ISLOWER(ch) _PyUnicode_IsLowercase(ch) … … 387 387 #define Py_UNICODE_ISALNUM(ch) \ 388 388 (Py_UNICODE_ISALPHA(ch) || \ 389 390 391 392 393 #define Py_UNICODE_COPY(target, source, length) 394 389 Py_UNICODE_ISDECIMAL(ch) || \ 390 Py_UNICODE_ISDIGIT(ch) || \ 391 Py_UNICODE_ISNUMERIC(ch)) 392 393 #define Py_UNICODE_COPY(target, source, length) \ 394 Py_MEMCPY((target), (source), (length)*sizeof(Py_UNICODE)) 395 395 396 396 #define Py_UNICODE_FILL(target, value, length) \ 397 397 do {Py_ssize_t i_; Py_UNICODE *t_ = (target); Py_UNICODE v_ = (value);\ 398 398 for (i_ = 0; i_ < (length); i_++) t_[i_] = v_;\ 399 399 } while (0) 400 400 … … 415 415 typedef struct { 416 416 PyObject_HEAD 417 Py_ssize_t length; 418 Py_UNICODE *str; 419 long hash; 420 PyObject *defenc; 421 422 417 Py_ssize_t length; /* Length of raw Unicode data in buffer */ 418 Py_UNICODE *str; /* Raw Unicode buffer */ 419 long hash; /* Hash value; -1 if not set */ 420 PyObject *defenc; /* (Default) Encoded version as Python 421 string, or NULL; this is used for 422 implementing the buffer protocol */ 423 423 } PyUnicodeObject; 424 424 … … 431 431 /* Fast access macros */ 432 432 #define PyUnicode_GET_SIZE(op) \ 433 433 (((PyUnicodeObject *)(op))->length) 434 434 #define PyUnicode_GET_DATA_SIZE(op) \ 435 435 (((PyUnicodeObject *)(op))->length * sizeof(Py_UNICODE)) 436 436 #define PyUnicode_AS_UNICODE(op) \ 437 437 (((PyUnicodeObject *)(op))->str) 438 438 #define PyUnicode_AS_DATA(op) \ 439 439 ((const char *)((PyUnicodeObject *)(op))->str) 440 440 441 441 /* --- Constants ---------------------------------------------------------- */ … … 453 453 454 454 /* Create a Unicode Object from the Py_UNICODE buffer u of the given 455 size. 455 size. 456 456 457 457 u may be NULL which causes the contents to be undefined. It is the … … 483 483 484 484 PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode( 485 PyObject *unicode 485 PyObject *unicode /* Unicode object */ 486 486 ); 487 487 … … 489 489 490 490 PyAPI_FUNC(Py_ssize_t) PyUnicode_GetSize( 491 PyObject *unicode 491 PyObject *unicode /* Unicode object */ 492 492 ); 493 493 … … 510 510 511 511 PyAPI_FUNC(int) PyUnicode_Resize( 512 PyObject **unicode, 513 Py_ssize_t length 512 PyObject **unicode, /* Pointer to the Unicode object */ 513 Py_ssize_t length /* New length */ 514 514 ); 515 515 … … 532 532 533 533 PyAPI_FUNC(PyObject*) PyUnicode_FromEncodedObject( 534 register PyObject *obj, 534 register PyObject *obj, /* Object */ 535 535 const char *encoding, /* encoding */ 536 536 const char *errors /* error handling */ … … 539 539 /* Coerce obj to an Unicode object and return a reference with 540 540 *incremented* refcount. 541 541 542 542 Unicode objects are passed back as-is (subclasses are converted to 543 543 true Unicode objects), all other objects are delegated to … … 551 551 552 552 PyAPI_FUNC(PyObject*) PyUnicode_FromObject( 553 register PyObject *obj 553 register PyObject *obj /* Object */ 554 554 ); 555 555 … … 560 560 (Advanced String Formatting). */ 561 561 PyAPI_FUNC(PyObject *) _PyUnicode_FormatAdvanced(PyObject *obj, 562 563 562 Py_UNICODE *format_spec, 563 Py_ssize_t format_spec_len); 564 564 565 565 /* --- wchar_t support for platforms which support it --------------------- */ … … 599 599 /* --- Unicode ordinals --------------------------------------------------- */ 600 600 601 /* Create a Unicode Object from the given Unicode code point ordinal. 602 601 /* Create a Unicode Object from the given Unicode code point ordinal. 602 603 603 The ordinal must be in range(0x10000) on narrow Python builds 604 604 (UCS2), and range(0x110000) on wide builds (UCS4). A ValueError is … … 620 620 PyAPI_FUNC(int) PyUnicode_ClearFreeList(void); 621 621 622 /* === Builtin Codecs ===================================================== 622 /* === Builtin Codecs ===================================================== 623 623 624 624 Many of these APIs take two arguments encoding and errors. These 625 625 parameters encoding and errors have the same semantics as the ones 626 of the builtin unicode() API. 626 of the builtin unicode() API. 627 627 628 628 Setting encoding to NULL causes the default encoding to be used. … … 641 641 642 642 /* Return a Python string holding the default encoded value of the 643 Unicode object. 643 Unicode object. 644 644 645 645 The resulting string is cached in the Unicode object for subsequent … … 663 663 interpreter to become a parameter which is managed on a per-thread 664 664 basis. 665 665 666 666 */ 667 667 … … 671 671 672 672 Returns 0 on success, -1 in case of an error. 673 673 674 674 */ 675 675 676 676 PyAPI_FUNC(int) PyUnicode_SetDefaultEncoding( 677 const char *encoding 677 const char *encoding /* Encoding name in standard form */ 678 678 ); 679 679 … … 690 690 ); 691 691 692 /* Encodes a Py_UNICODE buffer of the given size and returns a 692 /* Encodes a Py_UNICODE buffer of the given size and returns a 693 693 Python string object. */ 694 694 … … 704 704 705 705 PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedObject( 706 PyObject *unicode, 707 const char *encoding, 708 const char *errors 706 PyObject *unicode, /* Unicode object */ 707 const char *encoding, /* encoding */ 708 const char *errors /* error handling */ 709 709 ); 710 710 … … 713 713 714 714 PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedString( 715 PyObject *unicode, 716 const char *encoding, 717 const char *errors 715 PyObject *unicode, /* Unicode object */ 716 const char *encoding, /* encoding */ 717 const char *errors /* error handling */ 718 718 ); 719 719 … … 726 726 727 727 PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7( 728 const char *string, 729 Py_ssize_t length, 730 const char *errors 728 const char *string, /* UTF-7 encoded string */ 729 Py_ssize_t length, /* size of string */ 730 const char *errors /* error handling */ 731 731 ); 732 732 733 733 PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7Stateful( 734 const char *string, 735 Py_ssize_t length, 736 const char *errors, 737 Py_ssize_t *consumed 734 const char *string, /* UTF-7 encoded string */ 735 Py_ssize_t length, /* size of string */ 736 const char *errors, /* error handling */ 737 Py_ssize_t *consumed /* bytes consumed */ 738 738 ); 739 739 740 740 PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF7( 741 const Py_UNICODE *data, /* Unicode char buffer */ 742 Py_ssize_t length, /* number of Py_UNICODE chars to encode */ 743 int encodeSetO, /* force the encoder to encode characters in 744 Set O, as described in RFC2152 */ 745 int encodeWhiteSpace, /* force the encoder to encode space, tab, 746 carriage return and linefeed characters */ 747 const char *errors /* error handling */ 741 const Py_UNICODE *data, /* Unicode char buffer */ 742 Py_ssize_t length, /* number of Py_UNICODE chars to encode */ 743 int base64SetO, /* Encode RFC2152 Set O characters in base64 */ 744 int base64WhiteSpace, /* Encode whitespace (sp, ht, nl, cr) in base64 */ 745 const char *errors /* error handling */ 748 746 ); 749 747 … … 751 749 752 750 PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8( 753 const char *string, 754 Py_ssize_t length, 755 const char *errors 751 const char *string, /* UTF-8 encoded string */ 752 Py_ssize_t length, /* size of string */ 753 const char *errors /* error handling */ 756 754 ); 757 755 758 756 PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8Stateful( 759 const char *string, 760 Py_ssize_t length, 761 const char *errors, 762 Py_ssize_t *consumed 757 const char *string, /* UTF-8 encoded string */ 758 Py_ssize_t length, /* size of string */ 759 const char *errors, /* error handling */ 760 Py_ssize_t *consumed /* bytes consumed */ 763 761 ); 764 762 765 763 PyAPI_FUNC(PyObject*) PyUnicode_AsUTF8String( 766 PyObject *unicode 764 PyObject *unicode /* Unicode object */ 767 765 ); 768 766 769 767 PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF8( 770 const Py_UNICODE *data, 771 Py_ssize_t length, 772 const char *errors 768 const Py_UNICODE *data, /* Unicode char buffer */ 769 Py_ssize_t length, /* number of Py_UNICODE chars to encode */ 770 const char *errors /* error handling */ 773 771 ); 774 772 … … 779 777 780 778 errors (if non-NULL) defines the error handling. It defaults 781 to "strict". 779 to "strict". 782 780 783 781 If byteorder is non-NULL, the decoder starts decoding using the 784 782 given byte order: 785 783 786 787 788 784 *byteorder == -1: little endian 785 *byteorder == 0: native order 786 *byteorder == 1: big endian 789 787 790 788 In native mode, the first four bytes of the stream are checked for a … … 799 797 800 798 PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32( 801 const char *string, 802 Py_ssize_t length, 803 const char *errors, 804 int *byteorder 805 806 799 const char *string, /* UTF-32 encoded string */ 800 Py_ssize_t length, /* size of string */ 801 const char *errors, /* error handling */ 802 int *byteorder /* pointer to byteorder to use 803 0=native;-1=LE,1=BE; updated on 804 exit */ 807 805 ); 808 806 809 807 PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32Stateful( 810 const char *string, 811 Py_ssize_t length, 812 const char *errors, 813 int *byteorder, 814 815 816 Py_ssize_t *consumed 808 const char *string, /* UTF-32 encoded string */ 809 Py_ssize_t length, /* size of string */ 810 const char *errors, /* error handling */ 811 int *byteorder, /* pointer to byteorder to use 812 0=native;-1=LE,1=BE; updated on 813 exit */ 814 Py_ssize_t *consumed /* bytes consumed */ 817 815 ); 818 816 … … 821 819 822 820 PyAPI_FUNC(PyObject*) PyUnicode_AsUTF32String( 823 PyObject *unicode 821 PyObject *unicode /* Unicode object */ 824 822 ); 825 823 … … 841 839 842 840 PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF32( 843 const Py_UNICODE *data, 844 Py_ssize_t length, 845 const char *errors, 846 int byteorder 841 const Py_UNICODE *data, /* Unicode char buffer */ 842 Py_ssize_t length, /* number of Py_UNICODE chars to encode */ 843 const char *errors, /* error handling */ 844 int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ 847 845 ); 848 846 … … 853 851 854 852 errors (if non-NULL) defines the error handling. It defaults 855 to "strict". 853 to "strict". 856 854 857 855 If byteorder is non-NULL, the decoder starts decoding using the 858 856 given byte order: 859 857 860 861 862 858 *byteorder == -1: little endian 859 *byteorder == 0: native order 860 *byteorder == 1: big endian 863 861 864 862 In native mode, the first two bytes of the stream are checked for a … … 873 871 874 872 PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16( 875 const char *string, 876 Py_ssize_t length, 877 const char *errors, 878 int *byteorder 879 880 873 const char *string, /* UTF-16 encoded string */ 874 Py_ssize_t length, /* size of string */ 875 const char *errors, /* error handling */ 876 int *byteorder /* pointer to byteorder to use 877 0=native;-1=LE,1=BE; updated on 878 exit */ 881 879 ); 882 880 883 881 PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16Stateful( 884 const char *string, 885 Py_ssize_t length, 886 const char *errors, 887 int *byteorder, 888 889 890 Py_ssize_t *consumed 882 const char *string, /* UTF-16 encoded string */ 883 Py_ssize_t length, /* size of string */ 884 const char *errors, /* error handling */ 885 int *byteorder, /* pointer to byteorder to use 886 0=native;-1=LE,1=BE; updated on 887 exit */ 888 Py_ssize_t *consumed /* bytes consumed */ 891 889 ); 892 890 … … 895 893 896 894 PyAPI_FUNC(PyObject*) PyUnicode_AsUTF16String( 897 PyObject *unicode 895 PyObject *unicode /* Unicode object */ 898 896 ); 899 897 … … 919 917 920 918 PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF16( 921 const Py_UNICODE *data, 922 Py_ssize_t length, 923 const char *errors, 924 int byteorder 919 const Py_UNICODE *data, /* Unicode char buffer */ 920 Py_ssize_t length, /* number of Py_UNICODE chars to encode */ 921 const char *errors, /* error handling */ 922 int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ 925 923 ); 926 924 … … 928 926 929 927 PyAPI_FUNC(PyObject*) PyUnicode_DecodeUnicodeEscape( 930 const char *string, 931 Py_ssize_t length, 932 const char *errors 928 const char *string, /* Unicode-Escape encoded string */ 929 Py_ssize_t length, /* size of string */ 930 const char *errors /* error handling */ 933 931 ); 934 932 935 933 PyAPI_FUNC(PyObject*) PyUnicode_AsUnicodeEscapeString( 936 PyObject *unicode 934 PyObject *unicode /* Unicode object */ 937 935 ); 938 936 939 937 PyAPI_FUNC(PyObject*) PyUnicode_EncodeUnicodeEscape( 940 const Py_UNICODE *data, 941 Py_ssize_t length 938 const Py_UNICODE *data, /* Unicode char buffer */ 939 Py_ssize_t length /* Number of Py_UNICODE chars to encode */ 942 940 ); 943 941 … … 945 943 946 944 PyAPI_FUNC(PyObject*) PyUnicode_DecodeRawUnicodeEscape( 947 const char *string, 948 Py_ssize_t length, 949 const char *errors 945 const char *string, /* Raw-Unicode-Escape encoded string */ 946 Py_ssize_t length, /* size of string */ 947 const char *errors /* error handling */ 950 948 ); 951 949 952 950 PyAPI_FUNC(PyObject*) PyUnicode_AsRawUnicodeEscapeString( 953 PyObject *unicode 951 PyObject *unicode /* Unicode object */ 954 952 ); 955 953 956 954 PyAPI_FUNC(PyObject*) PyUnicode_EncodeRawUnicodeEscape( 957 const Py_UNICODE *data, 958 Py_ssize_t length 955 const Py_UNICODE *data, /* Unicode char buffer */ 956 Py_ssize_t length /* Number of Py_UNICODE chars to encode */ 959 957 ); 960 958 … … 969 967 ); 970 968 971 /* --- Latin-1 Codecs ----------------------------------------------------- 969 /* --- Latin-1 Codecs ----------------------------------------------------- 972 970 973 971 Note: Latin-1 corresponds to the first 256 Unicode ordinals. … … 976 974 977 975 PyAPI_FUNC(PyObject*) PyUnicode_DecodeLatin1( 978 const char *string, 979 Py_ssize_t length, 980 const char *errors 976 const char *string, /* Latin-1 encoded string */ 977 Py_ssize_t length, /* size of string */ 978 const char *errors /* error handling */ 981 979 ); 982 980 983 981 PyAPI_FUNC(PyObject*) PyUnicode_AsLatin1String( 984 PyObject *unicode 982 PyObject *unicode /* Unicode object */ 985 983 ); 986 984 987 985 PyAPI_FUNC(PyObject*) PyUnicode_EncodeLatin1( 988 const Py_UNICODE *data, 989 Py_ssize_t length, 990 const char *errors 991 ); 992 993 /* --- ASCII Codecs ------------------------------------------------------- 986 const Py_UNICODE *data, /* Unicode char buffer */ 987 Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ 988 const char *errors /* error handling */ 989 ); 990 991 /* --- ASCII Codecs ------------------------------------------------------- 994 992 995 993 Only 7-bit ASCII data is excepted. All other codes generate errors. … … 998 996 999 997 PyAPI_FUNC(PyObject*) PyUnicode_DecodeASCII( 1000 const char *string, 1001 Py_ssize_t length, 1002 const char *errors 998 const char *string, /* ASCII encoded string */ 999 Py_ssize_t length, /* size of string */ 1000 const char *errors /* error handling */ 1003 1001 ); 1004 1002 1005 1003 PyAPI_FUNC(PyObject*) PyUnicode_AsASCIIString( 1006 PyObject *unicode 1004 PyObject *unicode /* Unicode object */ 1007 1005 ); 1008 1006 1009 1007 PyAPI_FUNC(PyObject*) PyUnicode_EncodeASCII( 1010 const Py_UNICODE *data, 1011 Py_ssize_t length, 1012 const char *errors 1013 ); 1014 1015 /* --- Character Map Codecs ----------------------------------------------- 1016 1017 This codec uses mappings to encode and decode characters. 1008 const Py_UNICODE *data, /* Unicode char buffer */ 1009 Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ 1010 const char *errors /* error handling */ 1011 ); 1012 1013 /* --- Character Map Codecs ----------------------------------------------- 1014 1015 This codec uses mappings to encode and decode characters. 1018 1016 1019 1017 Decoding mappings must map single string characters to single … … 1036 1034 1037 1035 PyAPI_FUNC(PyObject*) PyUnicode_DecodeCharmap( 1038 const char *string, 1039 Py_ssize_t length, 1040 PyObject *mapping, /* character mapping1041 1042 const char *errors 1036 const char *string, /* Encoded string */ 1037 Py_ssize_t length, /* size of string */ 1038 PyObject *mapping, /* character mapping 1039 (char ordinal -> unicode ordinal) */ 1040 const char *errors /* error handling */ 1043 1041 ); 1044 1042 1045 1043 PyAPI_FUNC(PyObject*) PyUnicode_AsCharmapString( 1046 PyObject *unicode, 1047 PyObject *mapping /* character mapping1048 1044 PyObject *unicode, /* Unicode object */ 1045 PyObject *mapping /* character mapping 1046 (unicode ordinal -> char ordinal) */ 1049 1047 ); 1050 1048 1051 1049 PyAPI_FUNC(PyObject*) PyUnicode_EncodeCharmap( 1052 const Py_UNICODE *data, 1053 Py_ssize_t length, 1054 PyObject *mapping, /* character mapping1055 1056 const char *errors 1050 const Py_UNICODE *data, /* Unicode char buffer */ 1051 Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ 1052 PyObject *mapping, /* character mapping 1053 (unicode ordinal -> char ordinal) */ 1054 const char *errors /* error handling */ 1057 1055 ); 1058 1056 … … 1062 1060 1063 1061 The mapping table must map Unicode ordinal integers to Unicode 1064 ordinal integers or None (causing deletion of the character). 1062 ordinal integers or None (causing deletion of the character). 1065 1063 1066 1064 Mapping tables may be dictionaries or sequences. Unmapped character … … 1071 1069 1072 1070 PyAPI_FUNC(PyObject *) PyUnicode_TranslateCharmap( 1073 const Py_UNICODE *data, 1074 Py_ssize_t length, 1075 PyObject *table, 1076 const char *errors 1071 const Py_UNICODE *data, /* Unicode char buffer */ 1072 Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ 1073 PyObject *table, /* Translate table */ 1074 const char *errors /* error handling */ 1077 1075 ); 1078 1076 … … 1123 1121 NULL or "strict": raise a ValueError 1124 1122 "ignore": ignore the wrong characters (these are not copied to the 1125 1123 output buffer) 1126 1124 "replace": replaces illegal characters with '?' 1127 1125 … … 1131 1129 1132 1130 PyAPI_FUNC(int) PyUnicode_EncodeDecimal( 1133 Py_UNICODE *s, 1134 Py_ssize_t length, 1135 char *output, 1136 const char *errors 1131 Py_UNICODE *s, /* Unicode buffer */ 1132 Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ 1133 char *output, /* Output buffer; must have size >= length */ 1134 const char *errors /* error handling */ 1137 1135 ); 1138 1136 … … 1146 1144 1147 1145 PyAPI_FUNC(PyObject*) PyUnicode_Concat( 1148 PyObject *left, 1149 PyObject *right 1146 PyObject *left, /* Left string */ 1147 PyObject *right /* Right string */ 1150 1148 ); 1151 1149 … … 1162 1160 1163 1161 PyAPI_FUNC(PyObject*) PyUnicode_Split( 1164 PyObject *s, 1165 PyObject *sep, 1166 Py_ssize_t maxsplit 1167 ); 1162 PyObject *s, /* String to split */ 1163 PyObject *sep, /* String separator */ 1164 Py_ssize_t maxsplit /* Maxsplit count */ 1165 ); 1168 1166 1169 1167 /* Dito, but split at line breaks. … … 1171 1169 CRLF is considered to be one line break. Line breaks are not 1172 1170 included in the resulting list. */ 1173 1171 1174 1172 PyAPI_FUNC(PyObject*) PyUnicode_Splitlines( 1175 PyObject *s, 1176 int keepends 1177 ); 1173 PyObject *s, /* String to split */ 1174 int keepends /* If true, line end markers are included */ 1175 ); 1178 1176 1179 1177 /* Partition a string using a given separator. */ 1180 1178 1181 1179 PyAPI_FUNC(PyObject*) PyUnicode_Partition( 1182 PyObject *s, 1183 PyObject *sep 1184 ); 1180 PyObject *s, /* String to partition */ 1181 PyObject *sep /* String separator */ 1182 ); 1185 1183 1186 1184 /* Partition a string using a given separator, searching from the end of the … … 1188 1186 1189 1187 PyAPI_FUNC(PyObject*) PyUnicode_RPartition( 1190 PyObject *s, 1191 PyObject *sep 1192 ); 1188 PyObject *s, /* String to partition */ 1189 PyObject *sep /* String separator */ 1190 ); 1193 1191 1194 1192 /* Split a string giving a list of Unicode strings. … … 1206 1204 1207 1205 PyAPI_FUNC(PyObject*) PyUnicode_RSplit( 1208 PyObject *s, 1209 PyObject *sep, 1210 Py_ssize_t maxsplit 1211 ); 1206 PyObject *s, /* String to split */ 1207 PyObject *sep, /* String separator */ 1208 Py_ssize_t maxsplit /* Maxsplit count */ 1209 ); 1212 1210 1213 1211 /* Translate a string by applying a character mapping table to it and … … 1215 1213 1216 1214 The mapping table must map Unicode ordinal integers to Unicode 1217 ordinal integers or None (causing deletion of the character). 1215 ordinal integers or None (causing deletion of the character). 1218 1216 1219 1217 Mapping tables may be dictionaries or sequences. Unmapped character … … 1224 1222 1225 1223 PyAPI_FUNC(PyObject *) PyUnicode_Translate( 1226 PyObject *str, /* String */1227 PyObject *table, 1228 const char *errors 1224 PyObject *str, /* String */ 1225 PyObject *table, /* Translate table */ 1226 const char *errors /* error handling */ 1229 1227 ); 1230 1228 1231 1229 /* Join a sequence of strings using the given separator and return 1232 1230 the resulting Unicode string. */ 1233 1231 1234 1232 PyAPI_FUNC(PyObject*) PyUnicode_Join( 1235 PyObject *separator, 1236 PyObject *seq 1233 PyObject *separator, /* Separator string */ 1234 PyObject *seq /* Sequence object */ 1237 1235 ); 1238 1236 … … 1241 1239 1242 1240 PyAPI_FUNC(Py_ssize_t) PyUnicode_Tailmatch( 1243 PyObject *str, /* String */1244 PyObject *substr, 1245 Py_ssize_t start, 1246 Py_ssize_t end, 1247 int direction 1241 PyObject *str, /* String */ 1242 PyObject *substr, /* Prefix or Suffix string */ 1243 Py_ssize_t start, /* Start index */ 1244 Py_ssize_t end, /* Stop index */ 1245 int direction /* Tail end: -1 prefix, +1 suffix */ 1248 1246 ); 1249 1247 … … 1253 1251 1254 1252 PyAPI_FUNC(Py_ssize_t) PyUnicode_Find( 1255 PyObject *str, /* String */1256 PyObject *substr, 1257 Py_ssize_t start, 1258 Py_ssize_t end, 1259 int direction 1253 PyObject *str, /* String */ 1254 PyObject *substr, /* Substring to find */ 1255 Py_ssize_t start, /* Start index */ 1256 Py_ssize_t end, /* Stop index */ 1257 int direction /* Find direction: +1 forward, -1 backward */ 1260 1258 ); 1261 1259 … … 1263 1261 1264 1262 PyAPI_FUNC(Py_ssize_t) PyUnicode_Count( 1265 PyObject *str, /* String */1266 PyObject *substr, 1267 Py_ssize_t start, 1268 Py_ssize_t end 1263 PyObject *str, /* String */ 1264 PyObject *substr, /* Substring to count */ 1265 Py_ssize_t start, /* Start index */ 1266 Py_ssize_t end /* Stop index */ 1269 1267 ); 1270 1268 … … 1273 1271 1274 1272 PyAPI_FUNC(PyObject *) PyUnicode_Replace( 1275 PyObject *str, /* String */1276 PyObject *substr, 1277 PyObject *replstr, 1278 Py_ssize_t maxcount 1279 1273 PyObject *str, /* String */ 1274 PyObject *substr, /* Substring to find */ 1275 PyObject *replstr, /* Substring to replace */ 1276 Py_ssize_t maxcount /* Max. number of replacements to apply; 1277 -1 = all */ 1280 1278 ); 1281 1279 … … 1284 1282 1285 1283 PyAPI_FUNC(int) PyUnicode_Compare( 1286 PyObject *left, /* Left string */1287 PyObject *right 1284 PyObject *left, /* Left string */ 1285 PyObject *right /* Right string */ 1288 1286 ); 1289 1287 … … 1305 1303 1306 1304 PyAPI_FUNC(PyObject *) PyUnicode_RichCompare( 1307 PyObject *left, /* Left string */1308 PyObject *right, 1309 int op 1305 PyObject *left, /* Left string */ 1306 PyObject *right, /* Right string */ 1307 int op /* Operation: Py_EQ, Py_NE, Py_GT, etc. */ 1310 1308 ); 1311 1309 … … 1314 1312 1315 1313 PyAPI_FUNC(PyObject *) PyUnicode_Format( 1316 PyObject *format, /* Format string */1317 PyObject *args 1314 PyObject *format, /* Format string */ 1315 PyObject *args /* Argument tuple or dictionary */ 1318 1316 ); 1319 1317 … … 1325 1323 1326 1324 PyAPI_FUNC(int) PyUnicode_Contains( 1327 PyObject *container, /* Container string */1328 PyObject *element 1325 PyObject *container, /* Container string */ 1326 PyObject *element /* Element string */ 1329 1327 ); 1330 1328 … … 1343 1341 1344 1342 /* These should not be used directly. Use the Py_UNICODE_IS* and 1345 Py_UNICODE_TO* macros instead. 1343 Py_UNICODE_TO* macros instead. 1346 1344 1347 1345 These APIs are implemented in Objects/unicodectype.c. … … 1350 1348 1351 1349 PyAPI_FUNC(int) _PyUnicode_IsLowercase( 1352 Py_UNICODE ch 1350 Py_UNICODE ch /* Unicode character */ 1353 1351 ); 1354 1352 1355 1353 PyAPI_FUNC(int) _PyUnicode_IsUppercase( 1356 Py_UNICODE ch 1354 Py_UNICODE ch /* Unicode character */ 1357 1355 ); 1358 1356 1359 1357 PyAPI_FUNC(int) _PyUnicode_IsTitlecase( 1360 Py_UNICODE ch 1358 Py_UNICODE ch /* Unicode character */ 1361 1359 ); 1362 1360 1363 1361 PyAPI_FUNC(int) _PyUnicode_IsWhitespace( 1364 const Py_UNICODE ch 1362 const Py_UNICODE ch /* Unicode character */ 1365 1363 ); 1366 1364 1367 1365 PyAPI_FUNC(int) _PyUnicode_IsLinebreak( 1368 const Py_UNICODE ch 1366 const Py_UNICODE ch /* Unicode character */ 1369 1367 ); 1370 1368 1371 1369 PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToLowercase( 1372 Py_UNICODE ch 1370 Py_UNICODE ch /* Unicode character */ 1373 1371 ); 1374 1372 1375 1373 PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToUppercase( 1376 Py_UNICODE ch 1374 Py_UNICODE ch /* Unicode character */ 1377 1375 ); 1378 1376 1379 1377 PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToTitlecase( 1380 Py_UNICODE ch 1378 Py_UNICODE ch /* Unicode character */ 1381 1379 ); 1382 1380 1383 1381 PyAPI_FUNC(int) _PyUnicode_ToDecimalDigit( 1384 Py_UNICODE ch 1382 Py_UNICODE ch /* Unicode character */ 1385 1383 ); 1386 1384 1387 1385 PyAPI_FUNC(int) _PyUnicode_ToDigit( 1388 Py_UNICODE ch 1386 Py_UNICODE ch /* Unicode character */ 1389 1387 ); 1390 1388 1391 1389 PyAPI_FUNC(double) _PyUnicode_ToNumeric( 1392 Py_UNICODE ch 1390 Py_UNICODE ch /* Unicode character */ 1393 1391 ); 1394 1392 1395 1393 PyAPI_FUNC(int) _PyUnicode_IsDecimalDigit( 1396 Py_UNICODE ch 1394 Py_UNICODE ch /* Unicode character */ 1397 1395 ); 1398 1396 1399 1397 PyAPI_FUNC(int) _PyUnicode_IsDigit( 1400 Py_UNICODE ch 1398 Py_UNICODE ch /* Unicode character */ 1401 1399 ); 1402 1400 1403 1401 PyAPI_FUNC(int) _PyUnicode_IsNumeric( 1404 Py_UNICODE ch 1402 Py_UNICODE ch /* Unicode character */ 1405 1403 ); 1406 1404 1407 1405 PyAPI_FUNC(int) _PyUnicode_IsAlpha( 1408 Py_UNICODE ch 1406 Py_UNICODE ch /* Unicode character */ 1409 1407 ); 1410 1408 -
python/vendor/current/Include/weakrefobject.h
r2 r388 50 50 (Py_TYPE(op) == &_PyWeakref_CallableProxyType)) 51 51 52 /* This macro calls PyWeakref_CheckRef() last since that can involve a53 function call; this makes it more likely that the function call54 will be avoided. */55 52 #define PyWeakref_Check(op) \ 56 53 (PyWeakref_CheckRef(op) || PyWeakref_CheckProxy(op)) … … 67 64 PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self); 68 65 69 #define PyWeakref_GET_OBJECT(ref) (((PyWeakReference *)(ref))->wr_object) 66 /* Explanation for the Py_REFCNT() check: when a weakref's target is part 67 of a long chain of deallocations which triggers the trashcan mechanism, 68 clearing the weakrefs can be delayed long after the target's refcount 69 has dropped to zero. In the meantime, code accessing the weakref will 70 be able to "see" the target object even though it is supposed to be 71 unreachable. See issue #16602. */ 72 73 #define PyWeakref_GET_OBJECT(ref) \ 74 (Py_REFCNT(((PyWeakReference *)(ref))->wr_object) > 0 \ 75 ? ((PyWeakReference *)(ref))->wr_object \ 76 : Py_None) 70 77 71 78
Note:
See TracChangeset
for help on using the changeset viewer.