# PyLong\_Check, PyFloat\_Check

**URL:** <https://forum.modular.com/t/pylong-check-pyfloat-check/2383>\
**Category:** Python Interop\
**Created:** [October 18, 2025, 5:07pm UTC](https://forum.modular.com/t/pylong-check-pyfloat-check/2383 "2025-10-18T17:07:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mseritan](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/mseritan/32/130_2.png) [@mseritan](https://forum.modular.com/u/mseritan)\
**Post date:** [October 18, 2025, 5:07pm UTC](https://forum.modular.com/t/pylong-check-pyfloat-check/2383/1 "2025-10-18T17:07:06Z")

</div>

It seems that the type checking functions are missing from the python interface in stdlib.

Would you be interested by a PR to add them or is there some other workaround to check for the type of a PythonObject?

---

<div class="post-metadata">

**Author:** ![mseritan](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/mseritan/32/130_2.png) [@mseritan](https://forum.modular.com/u/mseritan)\
**Post date:** [October 19, 2025, 12:26am UTC](https://forum.modular.com/t/pylong-check-pyfloat-check/2383/2 "2025-10-19T00:26:53Z")

</div>

Ah, these are C defines 😢 [GitHub](https://github.com/python/cpython/blob/bedaea05987738c4c6b958d19cec9621bec09f07/Include/longobject.h#L12)

Looks like we want [Integer Objects — Python 3.13.9 documentation](https://docs.python.org/3.13/c-api/long.html#c.PyLong_Type)

---

<div class="post-metadata">

**Author:** ![mseritan](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/mseritan/32/130_2.png) [@mseritan](https://forum.modular.com/u/mseritan)\
**Post date:** [October 19, 2025, 7:17pm UTC](https://forum.modular.com/t/pylong-check-pyfloat-check/2383/3 "2025-10-19T19:17:59Z")

</div>

Here is the PR, feedback appreciated: [[stdlib] Add PyLong\_Check\* support by winding-lines · Pull Request #5480 · modular/modular · GitHub](https://github.com/modular/modular/pull/5480)

If/when this approach is acceptable I can extend to more types, in this PR or follow up PRs.

Many thanks,

Marius

---

<div class="post-metadata">

**Author:** ![sora](https://avatars.discourse-cdn.com/v4/letter/s/ad7895/32.png) [@sora](https://forum.modular.com/u/sora)\
**Post date:** [October 22, 2025, 12:08pm UTC](https://forum.modular.com/t/pylong-check-pyfloat-check/2383/4 "2025-10-22T12:08:00Z")

</div>

Hi, I will review your PR in the coming two days. Thanks for the patch!

---

<div class="post-metadata">

**Author:** ![mseritan](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/mseritan/32/130_2.png) [@mseritan](https://forum.modular.com/u/mseritan)\
**Post date:** [October 25, 2025, 2:41pm UTC](https://forum.modular.com/t/pylong-check-pyfloat-check/2383/5 "2025-10-25T14:41:12Z")

</div>

Thanks @sora !

I am propagating the pattern to bool and float this weekend. I will add the changes to this PR if you have not reviewed it yet, or a new PR if your review lands first.
