logoalt Hacker News

mananaysiempreyesterday at 2:32 PM4 repliesview on HN

The money shot (wish this were included in the blog post):

  #   if defined(_MSC_VER) && !defined(__clang__)
  #      define Py_MUSTTAIL [[msvc::musttail]]
  #      define Py_PRESERVE_NONE_CC __preserve_none
  #   else
  #       define Py_MUSTTAIL __attribute__((musttail))
  #       define Py_PRESERVE_NONE_CC __attribute__((preserve_none))
  #   endif
https://github.com/python/cpython/pull/143068/files#diff-45b...

Apparently(?) this also needs to be attached to the function declarator and does not work as a function specifier: `static void *__preserve_none slowpath();` and not `__preserve_none static void *slowpath();` (unlike GCC attribute syntax, which tends to be fairly gung-ho about this sort of thing, sometimes with confusing results).

Yay to getting undocumented MSVC features disclosed if Microsoft thinks you’re important enough :/


Replies

kenjin4096yesterday at 5:10 PM

So it seems I was wrong, [[msvc::musttail]] is documented! I will update the blog post to reflect that.

https://news.ycombinator.com/item?id=46385526

publicdebatesyesterday at 2:42 PM

Important enough, or benefits them directly? I have no good guesses how improving Python's performance would benefit them, but I would guess that's the real reason.

show 5 replies
monster_truckyesterday at 3:28 PM

[flagged]

show 3 replies