GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-73487: Convert _decimal to use Argument Clinic (part 5) by skirpichev · Pull Request #137948 · python/cpython

Conversation

@skirpichev

@skirpichev skirpichev commented Aug 19, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Issue: decimal: Use Argument Clinic #73487

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@skirpichev
skirpichev requested review from AA-Turner and serhiy-storchaka August 19, 2025 11:32
@skirpichev skirpichev added skip news topic-argument-clinic labels Aug 19, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Aug 19, 2025
decimal: Use Argument Clinic #73487
Closed
@skirpichev
skirpichev force-pushed the ac-decimal/73487-pt5 branch from 2cb6b67 to f1ee85f Compare August 20, 2025 09:44
serhiy-storchaka
serhiy-storchaka reviewed Aug 20, 2025
View reviewed changes
Comment thread Modules/_decimal/_decimal.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_decimal/_decimal.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@skirpichev
pythongh-73487: Convert _decimal to use Argument Clinic (part 5)
e4d3775
@skirpichev
skirpichev force-pushed the ac-decimal/73487-pt5 branch from f1ee85f to e4d3775 Compare August 21, 2025 02:29
@skirpichev
skirpichev marked this pull request as ready for review August 21, 2025 02:36
@bedevere-app bedevere-app Bot added the awaiting review label Aug 21, 2025
AA-Turner
AA-Turner reviewed Aug 21, 2025
View reviewed changes

@AA-Turner AA-Turner left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you plan to add the remaining macros to this PR?:

  • Dec_CONTEXT_GET_SSIZE
  • Dec_CONTEXT_GET_ULONG
  • Dec_UnaryNumberMethod
  • Dec_BinaryNumberMethod
  • DecCtx_BoolFunc
  • DecCtx_BoolFunc_NO_CTX
  • DecCtx_BinaryFunc_NO_CTX

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Modules/_decimal/_decimal.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_decimal/_decimal.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_decimal/_decimal.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_decimal/_decimal.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_decimal/_decimal.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

skirpichev and others added 2 commits August 21, 2025 06:00
@skirpichev
+1
3c66cf5
@skirpichev @AA-Turner
Apply suggestions from code review
d3f8428
Co-authored-by: Adam Turner <[email protected]>
@skirpichev
skirpichev force-pushed the ac-decimal/73487-pt5 branch from f32830b to 5d9dee8 Compare August 21, 2025 03:24
@skirpichev

skirpichev commented Aug 21, 2025

Copy link
Copy Markdown
Member Author

Do you plan to add the remaining macros to this PR?:

Yes. I think nothing left now.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@skirpichev
+2
94537e1
@skirpichev
skirpichev force-pushed the ac-decimal/73487-pt5 branch from 5d9dee8 to 94537e1 Compare August 21, 2025 03:55
@skirpichev

skirpichev commented Aug 21, 2025

Copy link
Copy Markdown
Member Author

Docstrings diff:

--- ref.txt 2025-08-21 06:56:01.528958090 +0300
+++ patch.txt   2025-08-21 06:54:44.217569503 +0300
@@ -268,8 +268,9 @@
      |      Compare the values numerically with their sign ignored.
      |
      |  minus(self, x, /)
-     |      Minus corresponds to the unary prefix minus operator in Python, but applies
-     |      the context to the result.
+     |      Minus corresponds to unary prefix minus in Python.
+     |
+     |      This operation applies the context to the result.
      |
      |  multiply(self, x, y, /)
      |      Return the product of x and y.
@@ -290,8 +291,9 @@
      |      Return an indication of the class of x.
      |
      |  plus(self, x, /)
-     |      Plus corresponds to the unary prefix plus operator in Python, but applies
-     |      the context to the result.
+     |      Plus corresponds to the unary prefix plus operator in Python.
+     |
+     |      This operation applies the context to the result.
      |
      |  power(self, /, a, b, modulo=None)
      |      Compute a**b.
@@ -317,12 +319,16 @@
      |      Return 10.
      |
      |  remainder(self, x, y, /)
-     |      Return the remainder from integer division.  The sign of the result,
-     |      if non-zero, is the same as that of the original dividend.
+     |      Return the remainder from integer division.
+     |
+     |      The sign of the result, if non-zero, is the same as that of the
+     |      original dividend.
      |
      |  remainder_near(self, x, y, /)
-     |      Return x - y * n, where n is the integer nearest the exact value of x / y
-     |      (if the result is 0 then its sign will be the sign of x).
+     |      Return x - y * n.
+     |
+     |      Here n is the integer nearest the exact value of x / y (if the result
+     |      is 0 then its sign will be the sign of x).
      |
      |  rotate(self, x, y, /)
      |      Return a copy of x, rotated by y places.
@@ -605,8 +611,9 @@
      |      Identical to compare, except that all NaNs signal.
      |
      |  compare_total(self, /, other, context=None)
-     |      Compare two operands using their abstract representation rather than
-     |      their numerical value.  Similar to the compare() method, but the result
+     |      Compare two operands using their abstract representation.
+     |
+     |      Similar to the compare() method, but the result
      |      gives a total ordering on Decimal instances.  Two Decimal instances with
      |      the same numeric value but different representations compare unequal
      |      in this ordering:
@@ -614,25 +621,28 @@
      |          >>> Decimal('12.0').compare_total(Decimal('12'))
      |          Decimal('-1')
      |
-     |      Quiet and signaling NaNs are also included in the total ordering. The result
-     |      of this function is Decimal('0') if both operands have the same representation,
-     |      Decimal('-1') if the first operand is lower in the total order than the second,
-     |      and Decimal('1') if the first operand is higher in the total order than the
-     |      second operand. See the specification for details of the total order.
-     |
-     |      This operation is unaffected by context and is quiet: no flags are changed
-     |      and no rounding is performed. As an exception, the C version may raise
-     |      InvalidOperation if the second operand cannot be converted exactly.
+     |      Quiet and signaling NaNs are also included in the total ordering. The
+     |      result of this function is Decimal('0') if both operands have the same
+     |      representation, Decimal('-1') if the first operand is lower in the
+     |      total order than the second, and Decimal('1') if the first operand is
+     |      higher in the total order than the second operand. See the
+     |      specification for details of the total order.
+     |
+     |      This operation is unaffected by context and is quiet: no flags are
+     |      changed and no rounding is performed. As an exception, the C version
+     |      may raise InvalidOperation if the second operand cannot be converted
+     |      exactly.
      |
      |  compare_total_mag(self, /, other, context=None)
-     |      Compare two operands using their abstract representation rather than their
-     |      value as in compare_total(), but ignoring the sign of each operand.
+     |      As compare_total(), but ignores the sign of each operand.
      |
-     |      x.compare_total_mag(y) is equivalent to x.copy_abs().compare_total(y.copy_abs()).
+     |      x.compare_total_mag(y) is equivalent to
+     |      x.copy_abs().compare_total(y.copy_abs()).
      |
-     |      This operation is unaffected by context and is quiet: no flags are changed
-     |      and no rounding is performed. As an exception, the C version may raise
-     |      InvalidOperation if the second operand cannot be converted exactly.
+     |      This operation is unaffected by context and is quiet: no flags are
+     |      changed and no rounding is performed. As an exception, the C version
+     |      may raise InvalidOperation if the second operand cannot be converted
+     |      exactly.
      |
      |  conjugate(self, /)
      |      Return self.
@@ -678,21 +688,19 @@
      |          Decimal('11')
      |
      |  is_canonical(self, /)
-     |      Return True if the argument is canonical and False otherwise.  Currently,
-     |      a Decimal instance is always canonical, so this operation always returns
-     |      True.
+     |      Return True if the argument is canonical and False otherwise.
+     |
+     |      Currently, a Decimal instance is always canonical, so this operation
+     |      always returns True.
      |
      |  is_finite(self, /)
-     |      Return True if the argument is a finite number, and False if the argument
-     |      is infinite or a NaN.
+     |      Return True if the argument is a finite number, and False otherwise.
      |
      |  is_infinite(self, /)
-     |      Return True if the argument is either positive or negative infinity and
-     |      False otherwise.
+     |      Return True if the argument is infinite, and False otherwise.
      |
      |  is_nan(self, /)
-     |      Return True if the argument is a (quiet or signaling) NaN and False
-     |      otherwise.
+     |      Return True if the argument is a (quiet or signaling) NaN, else False.
      |
      |  is_normal(self, /, context=None)
      |      Return True if the argument is a normal number and False otherwise.
@@ -704,6 +712,7 @@
      |
      |  is_signed(self, /)
      |      Return True if the argument has a negative sign and False otherwise.
+     |
      |      Note that both zeros and NaNs can carry signs.
      |
      |  is_snan(self, /)
@@ -716,8 +725,7 @@
      |      exponent less than Emin.
      |
      |  is_zero(self, /)
-     |      Return True if the argument is a (positive or negative) zero and False
-     |      otherwise.
+     |      Return True if the argument is a zero and False otherwise.
      |
      |  ln(self, /, context=None)
      |      Return the natural (base e) logarithm of the operand.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@skirpichev
skirpichev requested review from AA-Turner and serhiy-storchaka August 21, 2025 03:57
serhiy-storchaka
serhiy-storchaka reviewed Aug 21, 2025
View reviewed changes

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. 👍

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

skirpichev reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread Modules/_decimal/_decimal.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@skirpichev
address review: add comments & fix parameter names
416bce2
@skirpichev
skirpichev requested a review from serhiy-storchaka August 21, 2025 07:01
serhiy-storchaka
serhiy-storchaka approved these changes Aug 21, 2025
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Aug 21, 2025
AA-Turner
AA-Turner approved these changes Aug 21, 2025
View reviewed changes
@AA-Turner
AA-Turner merged commit bb8791c into python:main Aug 21, 2025
@bedevere-app bedevere-app Bot removed the awaiting merge label Aug 21, 2025
@skirpichev
skirpichev deleted the ac-decimal/73487-pt5 branch August 21, 2025 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@serhiy-storchaka serhiy-storchaka serhiy-storchaka approved these changes
@AA-Turner AA-Turner AA-Turner approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news topic-argument-clinic

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@skirpichev @serhiy-storchaka @AA-Turner
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.