@@ -5235,13 +5235,15 @@ _decimal_Decimal_copy_negate_impl(PyObject *self, PyTypeObject *cls)
52355235/*[clinic input]
52365236_decimal.Decimal.logical_invert = _decimal.Decimal.exp
52375237
5238- Return the digit-wise inversion of the (logical) operand.
5238+ Invert all its digits.
5239+
5240+ The self must be logical number.
52395241[clinic start generated code]*/
52405242
52415243static PyObject *
52425244_decimal_Decimal_logical_invert_impl (PyObject * self , PyTypeObject * cls ,
52435245 PyObject * context )
5244- /*[clinic end generated code: output=c626ed4b104a97b7 input=3531dac8b9548dad ]*/
5246+ /*[clinic end generated code: output=c626ed4b104a97b7 input=7158d5b525417955 ]*/
52455247Dec_UnaryFuncVA (mpd_qinvert )
52465248
52475249/*[clinic input]
@@ -5471,37 +5473,43 @@ _decimal_Decimal_same_quantum_impl(PyObject *self, PyTypeObject *cls,
54715473/*[clinic input]
54725474_decimal.Decimal.logical_and = _decimal.Decimal.compare
54735475
5474- Return the digit-wise 'and' of the two (logical) operands.
5476+ Applies an 'and' operation between self and other's digits.
5477+
5478+ Both self and other must be logical numbers.
54755479[clinic start generated code]*/
54765480
54775481static PyObject *
54785482_decimal_Decimal_logical_and_impl (PyObject * self , PyTypeObject * cls ,
54795483 PyObject * other , PyObject * context )
5480- /*[clinic end generated code: output=9a4cbb74c180b0bb input=2b319baee8970929 ]*/
5484+ /*[clinic end generated code: output=9a4cbb74c180b0bb input=f22460f1285782d2 ]*/
54815485Dec_BinaryFuncVA (mpd_qand )
54825486
54835487/*[clinic input]
54845488_decimal.Decimal.logical_or = _decimal.Decimal.compare
54855489
5486- Return the digit-wise 'or' of the two (logical) operands.
5490+ Applies an 'or' operation between self and other's digits.
5491+
5492+ Both self and other must be logical numbers.
54875493[clinic start generated code]*/
54885494
54895495static PyObject *
54905496_decimal_Decimal_logical_or_impl (PyObject * self , PyTypeObject * cls ,
54915497 PyObject * other , PyObject * context )
5492- /*[clinic end generated code: output=063c4de18dc41ecb input=75e0e1d4dd373b90 ]*/
5498+ /*[clinic end generated code: output=063c4de18dc41ecb input=b5afa1e1fdebdfce ]*/
54935499Dec_BinaryFuncVA (mpd_qor )
54945500
54955501/*[clinic input]
54965502_decimal.Decimal.logical_xor = _decimal.Decimal.compare
54975503
5498- Return the digit-wise 'xor' of the two (logical) operands.
5504+ Applies an 'xor' operation between self and other's digits.
5505+
5506+ Both self and other must be logical numbers.
54995507[clinic start generated code]*/
55005508
55015509static PyObject *
55025510_decimal_Decimal_logical_xor_impl (PyObject * self , PyTypeObject * cls ,
55035511 PyObject * other , PyObject * context )
5504- /*[clinic end generated code: output=829b09cb49926ad7 input=a1ed8d6ac38c1c9e ]*/
5512+ /*[clinic end generated code: output=829b09cb49926ad7 input=84d722ada08a2da7 ]*/
55055513Dec_BinaryFuncVA (mpd_qxor )
55065514
55075515/*[clinic input]
@@ -7099,13 +7107,26 @@ DecCtx_UnaryFunc(mpd_qlogb)
70997107/*[clinic input]
71007108_decimal.Context.logical_invert = _decimal.Context.abs
71017109
7102- Invert all digits of x.
7110+ Invert all the digits in the operand.
7111+
7112+ The operand must be a logical number.
7113+
7114+ >>> ExtendedContext.logical_invert(Decimal('0'))
7115+ Decimal('111111111')
7116+ >>> ExtendedContext.logical_invert(Decimal('1'))
7117+ Decimal('111111110')
7118+ >>> ExtendedContext.logical_invert(Decimal('111111111'))
7119+ Decimal('0')
7120+ >>> ExtendedContext.logical_invert(Decimal('101010101'))
7121+ Decimal('10101010')
7122+ >>> ExtendedContext.logical_invert(1101)
7123+ Decimal('111110010')
71037124[clinic start generated code]*/
71047125
71057126static PyObject *
71067127_decimal_Context_logical_invert_impl (PyObject * context , PyTypeObject * cls ,
71077128 PyObject * x )
7108- /*[clinic end generated code: output=97760277a958e2b0 input=1fa8dcc59c557fcc ]*/
7129+ /*[clinic end generated code: output=97760277a958e2b0 input=8e568f4c745ab596 ]*/
71097130DecCtx_UnaryFunc (mpd_qinvert )
71107131
71117132/*[clinic input]
@@ -7262,37 +7283,100 @@ _decimal_Context_copy_sign_impl(PyObject *context, PyTypeObject *cls,
72627283/*[clinic input]
72637284_decimal.Context.logical_and = _decimal.Context.add
72647285
7265- Digit-wise and of x and y.
7286+ Applies the logical operation 'and' between each operand's digits.
7287+
7288+ The operands must be both logical numbers.
7289+
7290+ >>> ExtendedContext.logical_and(Decimal('0'), Decimal('0'))
7291+ Decimal('0')
7292+ >>> ExtendedContext.logical_and(Decimal('0'), Decimal('1'))
7293+ Decimal('0')
7294+ >>> ExtendedContext.logical_and(Decimal('1'), Decimal('0'))
7295+ Decimal('0')
7296+ >>> ExtendedContext.logical_and(Decimal('1'), Decimal('1'))
7297+ Decimal('1')
7298+ >>> ExtendedContext.logical_and(Decimal('1100'), Decimal('1010'))
7299+ Decimal('1000')
7300+ >>> ExtendedContext.logical_and(Decimal('1111'), Decimal('10'))
7301+ Decimal('10')
7302+ >>> ExtendedContext.logical_and(110, 1101)
7303+ Decimal('100')
7304+ >>> ExtendedContext.logical_and(Decimal(110), 1101)
7305+ Decimal('100')
7306+ >>> ExtendedContext.logical_and(110, Decimal(1101))
7307+ Decimal('100')
72667308[clinic start generated code]*/
72677309
72687310static PyObject *
72697311_decimal_Context_logical_and_impl (PyObject * context , PyTypeObject * cls ,
72707312 PyObject * x , PyObject * y )
7271- /*[clinic end generated code: output=009dfa08ecaa2ac8 input=30ee33b5b365fd80 ]*/
7313+ /*[clinic end generated code: output=009dfa08ecaa2ac8 input=bcb7d3d6ab7530de ]*/
72727314DecCtx_BinaryFunc (mpd_qand )
72737315
72747316/*[clinic input]
72757317_decimal.Context.logical_or = _decimal.Context.add
72767318
7277- Digit-wise or of x and y.
7319+ Applies the logical operation 'or' between each operand's digits.
7320+
7321+ The operands must be both logical numbers.
7322+
7323+ >>> ExtendedContext.logical_or(Decimal('0'), Decimal('0'))
7324+ Decimal('0')
7325+ >>> ExtendedContext.logical_or(Decimal('0'), Decimal('1'))
7326+ Decimal('1')
7327+ >>> ExtendedContext.logical_or(Decimal('1'), Decimal('0'))
7328+ Decimal('1')
7329+ >>> ExtendedContext.logical_or(Decimal('1'), Decimal('1'))
7330+ Decimal('1')
7331+ >>> ExtendedContext.logical_or(Decimal('1100'), Decimal('1010'))
7332+ Decimal('1110')
7333+ >>> ExtendedContext.logical_or(Decimal('1110'), Decimal('10'))
7334+ Decimal('1110')
7335+ >>> ExtendedContext.logical_or(110, 1101)
7336+ Decimal('1111')
7337+ >>> ExtendedContext.logical_or(Decimal(110), 1101)
7338+ Decimal('1111')
7339+ >>> ExtendedContext.logical_or(110, Decimal(1101))
7340+ Decimal('1111')
72787341[clinic start generated code]*/
72797342
72807343static PyObject *
72817344_decimal_Context_logical_or_impl (PyObject * context , PyTypeObject * cls ,
72827345 PyObject * x , PyObject * y )
7283- /*[clinic end generated code: output=eb38617e8d31bf12 input=3b1a6725d0262fb9 ]*/
7346+ /*[clinic end generated code: output=eb38617e8d31bf12 input=47b45d296fb90846 ]*/
72847347DecCtx_BinaryFunc (mpd_qor )
72857348
72867349/*[clinic input]
72877350_decimal.Context.logical_xor = _decimal.Context.add
72887351
7289- Digit-wise xor of x and y.
7352+ Applies the logical operation 'xor' between each operand's digits.
7353+
7354+ The operands must be both logical numbers.
7355+
7356+ >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('0'))
7357+ Decimal('0')
7358+ >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('1'))
7359+ Decimal('1')
7360+ >>> ExtendedContext.logical_xor(Decimal('1'), Decimal('0'))
7361+ Decimal('1')
7362+ >>> ExtendedContext.logical_xor(Decimal('1'), Decimal('1'))
7363+ Decimal('0')
7364+ >>> ExtendedContext.logical_xor(Decimal('1100'), Decimal('1010'))
7365+ Decimal('110')
7366+ >>> ExtendedContext.logical_xor(Decimal('1111'), Decimal('10'))
7367+ Decimal('1101')
7368+ >>> ExtendedContext.logical_xor(110, 1101)
7369+ Decimal('1011')
7370+ >>> ExtendedContext.logical_xor(Decimal(110), 1101)
7371+ Decimal('1011')
7372+ >>> ExtendedContext.logical_xor(110, Decimal(1101))
7373+ Decimal('1011')
72907374[clinic start generated code]*/
72917375
72927376static PyObject *
72937377_decimal_Context_logical_xor_impl (PyObject * context , PyTypeObject * cls ,
72947378 PyObject * x , PyObject * y )
7295- /*[clinic end generated code: output=23cd81fdcd865d5a input=5ebbbe8bb35da380 ]*/
7379+ /*[clinic end generated code: output=23cd81fdcd865d5a input=fcaaf828c1d2d089 ]*/
72967380DecCtx_BinaryFunc (mpd_qxor )
72977381
72987382/*[clinic input]
0 commit comments