FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-135379: fix MSVC warning: conversion from 'stwodigits' to 'digit' by chris-eibl · Pull Request #135714 · python/cpython · GitHub

Repository navigation

gh-135379: fix MSVC warning: conversion from 'stwodigits' to 'digit' - #135714

Merged
Fidget-Spinner merged 1 commit into
python:mainfrom
chris-eibl:fix_msvc_warning
Jun 20, 2025
Merged

Fidget-Spinner merged 1 commit into
python:mainfrom
chris-eibl:fix_msvc_warning

Conversation

chris-eibl commented Jun 19, 2025 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

Fixes MSVC warning C4244: 'initializing': conversion from 'stwodigits' to 'digit', possible loss of data.

'stwodigits' to 'digit', possible loss of data
chris-eibl changed the title gh-135379: fix MSVC warning C4244: 'initializing': conversion from 'stwodigits' to 'digit', possible loss of data gh-135379: fix MSVC warning C4244: 'initializing': conversion from 'stwodigits' to 'digit' Jun 19, 2025
chris-eibl changed the title gh-135379: fix MSVC warning C4244: 'initializing': conversion from 'stwodigits' to 'digit' gh-135379: fix MSVC warning: conversion from 'stwodigits' to 'digit' Jun 19, 2025

Copy link
Copy Markdown
Member

Just checking: what does the rest of longobject do? Sorry I cant check myself as Im on mobile

Copy link
Copy Markdown
Member Author

There are many (digit) casts if something is assigned to a digit, but is a bigger data type.

Here that cast is missing, hence, MSVC fires the warning. Which is of no concern, since a few lines above

    if(!is_medium_int(x)) {
        return PyStackRef_NULL;
    }

ensures that the contents of stwodigits x is small enough to be cast into a digit without loss.

But since here a signed conversion takes place, too, I'd appreciate a second pair of eyes @markshannon ?

Fidget-Spinner merged commit 8272660 into python:main Jun 20, 2025
chris-eibl deleted the fix_msvc_warning branch June 20, 2025 20:51
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
…igit' (pythonGH-135714)

fix warning C4244: 'initializing': conversion from

'stwodigits' to 'digit', possible loss of data
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
…igit' (pythonGH-135714)

fix warning C4244: 'initializing': conversion from

'stwodigits' to 'digit', possible loss of data
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull request Aug 19, 2025
…igit' (pythonGH-135714)

fix warning C4244: 'initializing': conversion from

'stwodigits' to 'digit', possible loss of data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL