# Failure to patch pict2e to have a fillable oval

I am trying to patch "on the fly" pict2e.sty so that I can have filled ovals (this comes from here: https://github.com/Rmano/circledsteps/issues/5). I tried this:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pict2e, picture}
\usepackage{etoolbox}
\tracingpatches
\makeatletter
\newif\ifcstepsfilledovals
\patchcmd{\@oval}{\pIIe@strokeGraph}{%
\ifcstepsfilledovals\pIIe@fillGraph\else\pIIe@strokeGraph\fi
}{\typeout{OK}}{\typeout{FAIL}}
\makeatother

\begin{document}
\makebox(30pt,30pt){\put(0,0){\circle*{30pt}}}
\makebox(30pt,30pt){\put(0,0){\oval(30pt, 20pt)}}
\begingroup\cstepsfilledovalstrue
\makebox(30pt,30pt){\put(0,0){\oval(30pt, 20pt)}}
\endgroup
\makebox(30pt,30pt){\put(0,0){\oval(30pt, 20pt)}}

\end{document}


If I do the patch by hand, on a copy of the file, it works --- but etoolbox is saying this:

[debug] tracing \patchcmd on input line 9
[debug] analyzing '\@oval'
[debug] ++ control sequence is defined
[debug] ++ control sequence is a macro
[debug] ++ macro can be retokenized cleanly
FAIL


And I fail to see why. I suspect a catcode thing that I don't understand...

You're loading picture, which basically redefines every pict2e macro. In this case you need to patch \PcOrg@@oval.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pict2e, picture}
\usepackage{etoolbox}

\makeatletter
\newif\ifcstepsfilledovals
{\pIIe@strokeGraph}
{\ifcstepsfilledovals\pIIe@fillGraph\else\pIIe@strokeGraph\fi}
{\typeout{OK}}{\typeout{FAIL}}
\makeatother

\begin{document}
\makebox(30pt,30pt){\put(0,0){\circle*{30pt}}}
\makebox(30pt,30pt){\put(0,0){\oval(30pt, 20pt)}}
\begingroup\cstepsfilledovalstrue
\makebox(30pt,30pt){\put(0,0){\oval(30pt, 20pt)}}
\endgroup
\makebox(30pt,30pt){\put(0,0){\oval(30pt, 20pt)}}

\end{document}