A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://github.com/jcsalterego/py3k-atsign/commit/5c8bdf72d9252cea78af2b7809613f6530e25db4 below:

@ binary operator, PyUnicode_FormatPrime · jcsalterego/py3k-atsign@5c8bdf7 · GitHub

File tree Expand file treeCollapse file tree 15 files changed

+134

-8

lines changed

Filter options

Expand file treeCollapse file tree 15 files changed

+134

-8

lines changed Original file line number Diff line number Diff line change

@@ -228,6 +228,11 @@ result back on the stack.

228 228

Implements ``TOS = TOS1 % TOS``.

229 229 230 230 231 +

.. opcode:: BINARY_AT ()

232 + 233 +

Implements ``TOS = TOS1 @ TOS``.

234 + 235 + 231 236

.. opcode:: BINARY_ADD ()

232 237 233 238

Implements ``TOS = TOS1 + TOS``.

@@ -299,6 +304,11 @@ the original TOS1.

299 304

Implements in-place ``TOS = TOS1 % TOS``.

300 305 301 306 307 +

.. opcode:: INPLACE_AT ()

308 + 309 +

Implements in-place ``TOS = TOS1 @ TOS``.

310 + 311 + 302 312

.. opcode:: INPLACE_ADD ()

303 313 304 314

Implements in-place ``TOS = TOS1 + TOS``.

Original file line number Diff line number Diff line change

@@ -40,7 +40,7 @@ small_stmt: (expr_stmt | del_stmt | pass_stmt | flow_stmt |

40 40

expr_stmt: testlist (augassign (yield_expr|testlist) |

41 41

('=' (yield_expr|testlist))*)

42 42

augassign: ('+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^=' |

43 -

'<<=' | '>>=' | '**=' | '//=')

43 +

'<<=' | '>>=' | '**=' | '//=' | '@=')

44 44

# For normal assignments, additional restrictions enforced by the interpreter

45 45

del_stmt: 'del' exprlist

46 46

pass_stmt: 'pass'

@@ -94,7 +94,7 @@ xor_expr: and_expr ('^' and_expr)*

94 94

and_expr: shift_expr ('&' shift_expr)*

95 95

shift_expr: arith_expr (('<<'|'>>') arith_expr)*

96 96

arith_expr: term (('+'|'-') term)*

97 -

term: factor (('*'|'/'|'%'|'//') factor)*

97 +

term: factor (('*'|'/'|'%'|'@'|'//') factor)*

98 98

factor: ('+'|'-'|'~') factor | power

99 99

power: atom trailer* ['**' factor]

100 100

atom: ('(' [yield_expr|testlist_comp] ')' |

Original file line number Diff line number Diff line change

@@ -16,8 +16,8 @@ typedef struct _slice *slice_ty;

16 16

typedef enum _boolop { And=1, Or=2 } boolop_ty;

17 17 18 18

typedef enum _operator { Add=1, Sub=2, Mult=3, Div=4, Mod=5, Pow=6, LShift=7,

19 -

RShift=8, BitOr=9, BitXor=10, BitAnd=11, FloorDiv=12 }

20 -

operator_ty;

19 +

RShift=8, BitOr=9, BitXor=10, BitAnd=11, FloorDiv=12,

20 +

At=13 } operator_ty;

21 21 22 22

typedef enum _unaryop { Invert=1, Not=2, UAdd=3, USub=4 } unaryop_ty;

23 23 Original file line number Diff line number Diff line change

@@ -33,6 +33,8 @@ extern "C" {

33 33

#define BINARY_TRUE_DIVIDE 27

34 34

#define INPLACE_FLOOR_DIVIDE 28

35 35

#define INPLACE_TRUE_DIVIDE 29

36 +

#define BINARY_AT 30

37 +

#define INPLACE_AT 31

36 38 37 39

#define STORE_MAP 54

38 40

#define INPLACE_ADD 55

Original file line number Diff line number Diff line change

@@ -64,6 +64,7 @@ extern "C" {

64 64

#define OP 53

65 65

#define ERRORTOKEN 54

66 66

#define N_TOKENS 55

67 +

#define ATEQUAL 56

67 68 68 69

/* Special definitions for cooperation with parser */

69 70 Original file line number Diff line number Diff line change

@@ -189,6 +189,7 @@ typedef PY_UNICODE_TYPE Py_UNICODE;

189 189

# define PyUnicode_EncodeUnicodeEscape PyUnicodeUCS2_EncodeUnicodeEscape

190 190

# define PyUnicode_Find PyUnicodeUCS2_Find

191 191

# define PyUnicode_Format PyUnicodeUCS2_Format

192 +

# define PyUnicode_FormatPrime PyUnicodeUCS2_FormatPrime

192 193

# define PyUnicode_FromEncodedObject PyUnicodeUCS2_FromEncodedObject

193 194

# define PyUnicode_FromFormat PyUnicodeUCS2_FromFormat

194 195

# define PyUnicode_FromFormatV PyUnicodeUCS2_FromFormatV

@@ -288,6 +289,7 @@ typedef PY_UNICODE_TYPE Py_UNICODE;

288 289

# define PyUnicode_EncodeUnicodeEscape PyUnicodeUCS4_EncodeUnicodeEscape

289 290

# define PyUnicode_Find PyUnicodeUCS4_Find

290 291

# define PyUnicode_Format PyUnicodeUCS4_Format

292 +

# define PyUnicode_FormatPrime PyUnicodeUCS4_FormatPrime

291 293

# define PyUnicode_FromEncodedObject PyUnicodeUCS4_FromEncodedObject

292 294

# define PyUnicode_FromFormat PyUnicodeUCS4_FromFormat

293 295

# define PyUnicode_FromFormatV PyUnicodeUCS4_FromFormatV

@@ -1464,6 +1466,11 @@ PyAPI_FUNC(PyObject *) PyUnicode_Format(

1464 1466

PyObject *args /* Argument tuple or dictionary */

1465 1467

);

1466 1468 1469 +

PyAPI_FUNC(PyObject *) PyUnicode_FormatPrime(

1470 +

PyObject *format, /* Format string */

1471 +

PyObject *args /* Argument tuple or dictionary */

1472 +

);

1473 + 1467 1474

/* Checks whether element is contained in container and return 1/0

1468 1475

accordingly.

1469 1476 Original file line number Diff line number Diff line change

@@ -68,6 +68,8 @@ def jabs_op(name, op):

68 68

def_op('BINARY_TRUE_DIVIDE', 27)

69 69

def_op('INPLACE_FLOOR_DIVIDE', 28)

70 70

def_op('INPLACE_TRUE_DIVIDE', 29)

71 +

def_op('BINARY_AT', 30)

72 +

def_op('INPLACE_AT', 31)

71 73 72 74

def_op('STORE_MAP', 54)

73 75

def_op('INPLACE_ADD', 55)

Original file line number Diff line number Diff line change

@@ -1547,6 +1547,7 @@ validate_expr_stmt(node *tree)

1547 1547

|| strcmp(s, "/=") == 0

1548 1548

|| strcmp(s, "//=") == 0

1549 1549

|| strcmp(s, "%=") == 0

1550 +

|| strcmp(s, "@=") == 0

1550 1551

|| strcmp(s, "&=") == 0

1551 1552

|| strcmp(s, "|=") == 0

1552 1553

|| strcmp(s, "^=") == 0

@@ -2251,7 +2252,8 @@ validate_term(node *tree)

2251 2252

res = (((TYPE(CHILD(tree, pos)) == STAR)

2252 2253

|| (TYPE(CHILD(tree, pos)) == SLASH)

2253 2254

|| (TYPE(CHILD(tree, pos)) == DOUBLESLASH)

2254 -

|| (TYPE(CHILD(tree, pos)) == PERCENT))

2255 +

|| (TYPE(CHILD(tree, pos)) == PERCENT)

2256 +

|| (TYPE(CHILD(tree, pos)) == AT))

2255 2257

&& validate_factor(CHILD(tree, pos + 1)));

2256 2258 2257 2259

return (res);

Original file line number Diff line number Diff line change

@@ -9067,6 +9067,71 @@ formatchar(Py_UNICODE *buf,

9067 9067

return -1;

9068 9068

}

9069 9069 9070 +

PyObject *

9071 +

PyUnicode_FormatPrime(PyObject *format, PyObject *args)

9072 +

{

9073 +

Py_ssize_t arglen;

9074 +

PyObject *dict, *last_item, *retval, *tuple;

9075 +

int args_ref = 0, tuple_ref = 0;

9076 + 9077 +

if (format == NULL || args == NULL) {

9078 +

PyErr_BadInternalCall();

9079 +

return NULL;

9080 +

} else if (!PyUnicode_Check(format)) {

9081 +

PyErr_Format(PyExc_TypeError,

9082 +

"unsupported operand type(s) for %.100s: "

9083 +

"'%.100s' and '%.100s'",

9084 +

"@",

9085 +

format->ob_type->tp_name,

9086 +

args->ob_type->tp_name);

9087 +

return NULL;

9088 +

}

9089 + 9090 +

/* default values */

9091 +

tuple = args;

9092 +

dict = NULL;

9093 + 9094 +

if (PyTuple_Check(args)) {

9095 +

arglen = PyTuple_Size(args);

9096 + 9097 +

if (arglen > 1) {

9098 +

/* check for existence of dict at end */

9099 +

last_item = PyTuple_GetItem(args, arglen - 1);

9100 + 9101 +

if (PyDict_CheckExact(last_item)) {

9102 +

dict = last_item;

9103 + 9104 +

/* clone n - 1 elements of an n-sized tuple...

9105 +

* does this introduce a memory leak?

9106 +

*/

9107 +

tuple = PyTuple_GetSlice(args, 0, arglen - 1);

9108 +

args_ref = 1;

9109 +

}

9110 +

}

9111 +

}

9112 +

else if (PyDict_Check(args)) {

9113 +

tuple = PyTuple_New(0);

9114 +

if (!tuple)

9115 +

return NULL;

9116 +

dict = args;

9117 +

}

9118 +

else {

9119 +

/* pass as one-length tuple */

9120 +

tuple = PyTuple_New(1);

9121 +

tuple_ref = 1;

9122 +

PyTuple_SetItem(tuple, 0, args);

9123 +

Py_INCREF(args);

9124 +

}

9125 + 9126 +

retval = do_string_format(format, tuple, dict);

9127 +

if (tuple_ref)

9128 +

Py_DECREF(tuple);

9129 +

if (args_ref)

9130 +

Py_DECREF(args);

9131 +

return retval;

9132 +

}

9133 + 9134 + 9070 9135

/* fmt%(v1,v2,...) is roughly equivalent to sprintf(fmt, v1, v2, ...)

9071 9136

FORMATBUFLEN is the length of the buffer in which chars are formatted.

9072 9137

*/

Original file line number Diff line number Diff line change

@@ -93,6 +93,7 @@ module Python version "$Revision: 67616 $"

93 93 94 94

operator = Add | Sub | Mult | Div | Mod | Pow | LShift

95 95

| RShift | BitOr | BitXor | BitAnd | FloorDiv

96 +

| At

96 97 97 98

unaryop = Invert | Not | UAdd | USub

98 99

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4